首页 > 代码库 > DataSet key points

DataSet key points

In a typical multiple-tier implementation, the steps for creating and refreshing a DataSet, and in turn, updating the original data are to:

  1. Build and fill each DataTable in a DataSet with data from a data source using a DataAdapter.

  2. Change the data in individual DataTable objects by adding, updating, or deleting DataRow objects.

  3. Invoke the GetChanges method to create a second DataSet that features only the changes to the data.

  4. Call the Update method of the DataAdapter, passing the second DataSet as an argument.

  5. Invoke the Merge method to merge the changes from the second DataSet into the first.

  6. Invoke the AcceptChanges on the DataSet. Alternatively, invoke RejectChanges to cancel the changes.