This is preliminary documentation and subject to change. To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!
General steps for using a DataSet With Existing Data
These are the general steps to use a DataSet with existing data:
Build and fill each table in a DataSet with data from a DBMS using a SQLDataSetCommand or ADODataSetCommand. See Creating a Simple DataSetCommand
Change the data in individual DataTable objects by adding, updating, or deleting DataRow objects. See ...
Invoke the GetChanges method to create a second DataSet that features only the changes to the data. The method requires one argument, the DataRowState of the changes you are interested in. The example below uses the method to return a DataSet with only the modified rows:
[VB]
Dim changedDataSet As DataSet
changedDataSet = ds.GetChanges(DataRowState.Modified)
[C#]
System.Data.DataSet changedDataSet;
changedDataSet = ds.GetChanges(DataRowState.Modified);
Check for errors in the second DataSet by examining its HasErrors property, which informs you if any table in the set has errors. See section…
If errors are present, check the HasErrors property of each DataTable . If the table has errors, invoke the DataTable class's GetErrors method to return an array of DataRow objects with errors.
On each DataRow examine the RowError property for specific data.
Reconcile the errors, if possible.
Invoke the Merge method to merge the changes from the second DataSet into the first.