享受代码,享受人生

SOA is an integration solution. SOA is message oriented first.
The Key character of SOA is loosely coupled. SOA is enriched
by creating composite apps.
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

How to use DataSet

Posted on 2005-12-05 15:51  idior  阅读(1594)  评论(0编辑  收藏  举报
  1. Fill the tables for your DataSet using a stored procedure or SQL.
     
  2. Display the data in various DataTable objects within your DataSet by either binding to a control or looping through the rows in the tables.
     
  3. Change data in individual DataTable objects by adding, modifying, or deleting DataRow objects.
     
  4. Invoke the GetChanges( ) method to create a second DataSet that features only the changes to the data.
     
  5. Check for errors in the second newly created DataSet by examining the HasErrors property. If there are errors, check the HasErrors property of each DataTable in the DataSet. If the table has errors, invoke the GetErrors( ) method of the DataTable and get back an array of DataRow objects with errors. On each row you can examine the RowError property for specific information about the error, which you can then resolve.
     
  6. Merge the second Data Set with the first.
     
  7. Call the Update( ) method on the DataAdapter object and pass in the second (changed) DataSet.
     
  8. Invoke the AcceptChanges( ) method on the DataSet, or invoke RejectChanges( ) to cancel the changes.

    This way is typically use for update Modified DataSet.
    
    See some details about this in following article:
    http://www.akadia.com/services/dotnet_update_form.html