asp.net.ph

DataSet.RejectChanges Method

System.Data Namespace   DataSet Class


Rolls back all the changes made to the DataSet since it was created, or since the last time DataSet.AcceptChanges was called.

[ VB ]
Overridable Public Sub RejectChanges ( )

[ C# ]
public virtual void RejectChanges ( );

[ C++ ]
public: virtual void RejectChanges ( );

[ JScript ]
public function RejectChanges ( );

Remarks

Invoke the DataSet.RejectChanges to call the DataTable.RejectChanges method on all DataTable objects contained by the DataSet. Additionally, any Constraint rules contained by the DataSet are enforced.

DataRow objects contained by the DataSet can each be set into edit mode by invoking the DataRow.BeginEdit method. After invoking the DataRow.EndEdit method, changes can be rejected by calling the DataTable.RejectChanges on the DataTable to which the DataRow objects belong.

When the DataTable.RejectChanges method is called, any rows still in edit-mode cancel their edits. New rows are removed. Modified and deleted rows return back to their original state ( DataRowState.Unchanged ).

Example

The following example shows a class derived from the DataSet class. The RejectChanges event invoked from within a function.

private void RejectChangesInDataSet ( ) {
   // instantiate the derived DataSet.
   DerivedDataSet myDerivedDataSet = new DerivedDataSet ( );

   // ... insert code here to change values ...

   // invoke the RejectChanges method in the derived class.
   myDerivedDataSet.RejectDataSetChanges ( );
}

public class DerivedDataSet:System.Data.DataSet {

   void RejectDataSetChanges ( ) {
      // invoke the RejectChanges method.
      this.RejectChanges ( );
   }
}
  C# VB

See Also

DataSet Members   AcceptChanges Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

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

You can help support asp.net.ph