[ Team LiB ] Recipe Merging Data Problem You have two DataSet objects with the same schema, but containing different data. You need to combine data from these two DataSet objects without creating duplicate rows. Solution Use the DataSet. | Team LiB Recipe Merging Data Problem You have two DataSet objects with the same schema but containing different data. You need to combine data from these two DataSet objects without creating duplicate rows. Solution Use the method with the appropriate MissingSchemaAction enumeration values. The sample code contains four event handlers and a single method Sets up the sample by creating two DataSet objects each with a single DataTable containing different subset of data from the Employees table in Northwind. The default view for each table is bound to a data grid on the form. MergeA The first calls the Merge method to merge the first DataSet into the second. MergeB A second calls the Merge method to merge the second DataSet into the first. Clear A third clears the data grid displaying the results of either merge. Merge This method takes two DataTable arguments. The first DataTable is copied to a new DataTable and the second DataTable is merged into it with the specified MissingSchemaAction. The default view of the result DataTable is bound to a data grid on the form. The C code is shown in Example 5-6. Example 5-6. File Namespaces variables and constants using System using using using using private SqlDataAdapter daA daB private DataSet dsA dsB . . . private void MergingDataForm_Load object sender e Fill the schema and data for table A. String sqlText SELECT EmployeelD LastName FirstName Title FROM Employees WHERE EmployeelD BETWEEN 1 AND 5 Set up the DataAdapter and CommandBuilder for table A. SqlCommandBuilder cbA new SqlCommandBuilder daA daA new SqlDataAdapter sqlText S ql_S qlAuth_ConnectString Define DataSet A and fill its table A with schema and data. dsA new DataSet A dsA .