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.
| posted on Wednesday, October 22, 2003 12:20 PM