Copying DataTables

The project I am on sources data from both Mainframe (DB2)and SQL Server. The data is delivered to the front end via web service methods as an XML stream.

In most situations all the data "joining" is already done in the middle tier, but for a particular use case, the front end must manage 2 different XML streams (one from DB2 and the other from SQL)

First thought was to use the XML classes in .NET but another easier option was to use DataSets.

Each stream is loaded into a data set via the LoadXML method. The data schemas are too different to attempt any sort of merge operation so the creation of a new DataSet is called for.

Using the SELECT method with a "WHERE" clause, we can pull the necessary data from each DataTable in each DataSet and add these to our new data set.

A "gotcha" is if you have to add the entire table from one dataset to the other. The DataTable must be copied using the Copy method. The Clone method will not cut it and produces a "Cannot add a DataTable that is already part of another DataSet."

This is a short term solution while we wait for the middler tier to combine them for us.

Print | posted on Wednesday, October 22, 2003 12:20 PM

Feedback

# re: Copying DataTables

left by Cake Boy at 7/21/2004 2:17 AM Gravatar
If you want the whole table with a where clause why not use Where 1=1?

# re: Copying DataTables

left by Ajith at 1/13/2006 9:20 PM Gravatar
good

# re: Copying DataTables

left by Uma at 3/30/2006 1:43 AM Gravatar
thanks

# re: Copying DataTables

left by imranali at 6/28/2006 8:04 PM Gravatar
this website is providing great help for programmers who ever in beginning og realtime programming stage
Comments have been closed on this topic.