index > .NET Framework Data Access and Storage > Dataset with two tables from different sources

Dataset with two tables from different sources

I am trying to resolve a problem. I have the following.

One dataset, we'll call dsPatientInformation

Table #1 inside dsPatientInformation called tbPatientDemo.
tbPatientDemo source comes from a SQL DB and has fields,
PatientID, PatientName, PatientState

Table #2 inside dsPatientInformation called tbPatientBalance.
tbPatientBalance source comes from ACCESS and has two fields,
PatientID, PatientBalance

I need data to end up in the following format,
PatientID, PatientName, PatientState, PatientBalance

Now yes I could add a new column to Table #1 called PatientBalance, then loop through the rows of Table #1 and perform a lookup on Table #2 to insert the patient balance into my new column.

Using a merge would just append the records from Table #2 into Table #1, that would not solve my problem.

I would love to be able to perform a query of
Select Table1.PatientID, Table1.PatientName, Table1.PatientState, Table2.PatientBalance From Table1 Join On Table2 Where Table1.PatientID = Table2.PatientID
against the two tables within the dataset, but I cannot find any method to do this.

Any assistance would be appreciated.




Curt Broyles
Curt Broyles

Hi,

I think your solution is to move everything to XML from the DataSet and then transform into a new XML - the one that you need - using XSLT

I think you would have to full fill your tables in the dataset direct from the sources you have - Sql and access. After that you can create a relation between those tables in the dataset ( remeber it is disconected data by now, so the data source is not importante any more ). After this, you save all the information as a xml document, and the transforms it into a new XML using a xslt - you have to write your own xslt -, then you read the xml from a table and you will have the information in the format you want

Best Regards




Diego Rojas.
Luis D. Rojas

I have exactly the same problem, as I am sure do a lot of people since this seems a fairly trypical action.

Is this still the only way to do this? It seems completely daft that a 'disconnected model of the DB' won't let you use the most basic SQL commands that exist in a real connected DB!

Thank you for any help you can give.




M162
Mendip162

Hi,

another option can be given by the merge method of a dataset, but you have to see if it "fits" in what you want to do

Here is a link in msdn for checking the DataSet.Merge Method




Diego Rojas.
Luis D. Rojas
reply 4

You can use google to search for other answers

 

More Articles

• To clean pool of connections in ADO.NET
• SQL Server Procedure call timeout from .Net
• Question regarding TableAdapters.
• EXE (client PC) don´t show null values
• An error has occurred while establishing a connection to the serv...
• Framework Versions
• Excel.PivotTable.SourceData
• using vs.net2005 dataset
• Joined tables, update database with many rows, What is Best Pract...
• Linked tables from ASP.NET problem: OleDbException (0x80004005)
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• Can't figure out this error message
• SQLBulkCopy and text files.
• SqlRowsCopied event in SqlBulkCopy + .NE
• Processing 'text' files, fixed width, .C
• writing image into word document in asp.
• Null Value exception thrown, need to cha
• TransactionScope ignores timeout option
• OLE DB and Visual FoxPro
• interacting applications
• How to control root node name for the Da
• Database Structure design and User Inter
• ComputerEase ODBC Date Insert/Update pro
• How does .NET Data Provider for SQL Serv
• Import data from Excel
• poor oracleclient performance (System.Da

Hot Articles

• Returning DataReaders
• DataTable - Null Object Reference Error
• Connection Timeout
• How to invoke a .asp file or .aspx file
• Regional Settings, depending of the form
• Save and retrieve RTF Text from MSSQL DB
• Same Problem on using System.Transactions
• Selecting / Update records - Concurrancy
• Problem Enumerating Sql Server Using Sys
• Which Method is Better for Transferring
• unable to upload image to one of two ima
• no option to connect system.data.oledb
• Dinamically adding columns
• What is the List<OdbcParameter>.En
• Trying to get access to Access DB from V

Recommend Articles

• Enterprise Library problem with oracle 1
• Transaction
• Visual Studio 2003 with SQL Server 2005
• Problem in element order - while writtin
• how to use where clause in data adapter
• SQLExpress - SQLDataAdapter Conflict
• Problem looping over rows created within
• Best Practices question.
• DataTable Stripping time from DateTime
• EXE (client PC) don´t show null values
• Dataset Update
• Execute a sql script using vb.net
• Bug with DeriveParameters?
• DataFormatString for DateTime column
• how to get a javascript value in c#