NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DataSet.Merge (DataTable, Boolean, MissingSchemaAction)

Merges this DataTable into a specified DataTable. with a value to preserve changes made to the target, and a value to deal with missing schemas.

[Visual Basic]
Overloads Public Sub Merge( _
   ByVal table As DataTable, _
   ByVal preserveChanges As Boolean, _
   ByVal missingSchemaAction As MissingSchemaAction _
)
[C#]
public void Merge(
   DataTable table,
   bool preserveChanges,
   MissingSchemaAction missingSchemaAction
);
[C++]
public: void Merge(
   DataTable* table,
   bool preserveChanges,
   MissingSchemaAction missingSchemaAction
);
[JScript]
public function Merge(
   table : DataTable,
   preserveChanges : Boolean,
   missingSchemaAction : MissingSchemaAction
);

Parameters

table
The DataSet whose data and schema will be merged.
preserveChanges
Whether changes in the current (target) DataSet should be maintained.
missingSchemaAction
One of the MissingSchemaAction values that specify what to do with an incompatible schema. Possible values include Add (for example, add a column), Ignore, or Error.

Exceptions

Exception Type Condition
ArgumentNullException The dataSet is a null reference (in Visual Basic Nothing).

Remarks

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 missingSchemaAction is set to Add, and the source table is missing in the target it will be added. If set to Ignore, source data from the missing table is ignored. If set to Error, an error will be thrown.

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.

See Also

DataSet Class | DataSet Members | System.Data Namespace | DataSet.Merge Overload List