Merges this DataTable into a specified DataTable.
[Visual Basic] Overloads Public Sub Merge( _ ByVal table As DataTable _ ) [C#] public void Merge( DataTable table ); [C++] public: void Merge( DataTable* table ); [JScript] public function Merge( table : DataTable );
Exception Type | Condition |
---|---|
ArgumentNullException | The dataSet is a null reference (in Visual Basic Nothing). |
Merges the specified DataTable (the source) into the current DataSet (the target). An attempt is made to locate the source DataTable in this DataSet. If the schemas of the two tables are incompatible, the missing columns will be added.
When the Merge method is called, the schemas of the two DataSet objects are compared. If the source DataSet contains schema elements that are missing in the target, the schema elements are added to the target. The data is then merged. When merging rows that have a DataRowState value of Unchanged, Modified, or Deleted source rows, the source's primary key is used to search for target rows that have the same primary key values. When merging New source rows, the new primary key value is used to search for target rows that are also New and have matching new primary keys.
DataSet Class | DataSet Members | System.Data Namespace | DataSet.Merge Overload List