asp.net.ph

DataSet.GetChanges Method

System.Data Namespace   DataSet Class


Returns a copy of the DataSet containing all changes made to it since it was last loaded, or since AcceptChanges was called.

Overload List

1. Returns a copy of the DataSet that contains all changes made to it since it was loaded or AcceptChanges was last called.

2. Returns a copy of the DataSet containing all changes made to it since it was last loaded, or since AcceptChanges was called, filtered by DataRowState.


Example

The following example uses the GetChanges method to create a second DataSet object that is then used to update a data source.

NOTE: This example uses one of the overloaded versions of GetChanges. For other examples that may be available, see the individual overload topics.

private void UpdateDataSet ( DataSet myDataSet ) {
   // check for changes with the HasChanges method first.
   if ( !myDataSet.HasChanges ( DataRowState.Modified ) ) return;
   // create temporary DataSet variable.
   DataSet xDataSet;
   // getChanges for modified rows only.
   xDataSet = myDataSet.GetChanges ( DataRowState.Modified );
   // check the DataSet for errors.
   if ( xDataSet.HasErrors ) {
      // ... insert code to resolve errors here ...
  }
   // after fixing errors, update the DBMS with the DataAdapter
   // used to create the DataSet.
   myOleDbDataAdapter.Update ( xDataSet );
}
  C# VB

See Also

DataSet Members   HasChanges   HasErrors Skip Navigation Links




Previous page Back to top Next page

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note