打印本文 打印本文 关闭窗口 关闭窗口
第五课 使用断开数据--DataSet和SqlDataAdapter(翻译)
作者:武汉SEO闵涛  文章来源:敏韬网  点击数15896  更新时间:2007/11/14 13:12:43  文章录入:mintao  责任编辑:mintao
更新改变

After modifications are made to the data, you''''ll want to write the changes back to the data base.  Refer to previous discussion in the Introduction of this article on update guidance.  The following code shows how to use the Update method of the SqlDataAdapter to push modifications back to the data base.

在对数据做了修改以后,你将需要将改变写回给数据库。参考在这篇文章开始介绍的关于update的讨论,下面的代码展示了如何使用SqlDataAdapterUpdate方法将改变传回数据库。

daCustomers.Update(dsCustomers, "Customers");

The Update method, above, is called on the SqlDataAdapter instance that originally filled the dsCustomers DataSet.  The second parameter to the Update method specifies which table, from the DataSet, to update.  The table contains a list of records that have been modified and the Insert, Update, and Delete properties of the SqlDataAdapter contain the SQL statements used to make data base modifications.

上面的Update方法调用了最初填充dsCustomers数据集的SalDataAdapter实例。Update方法的第二个参数指定了从数据集中的哪个表来更新。这张表中包含一组被修改的记录,并且使用SqlDataAdapterInsertUpdateDelete属性包含的SQL语句来做数据库的修改。

Putting it All Together

整合

 << 上一页  [11] [12] [13] [14] [15] [16] [17] [18]  下一页

打印本文 打印本文 关闭窗口 关闭窗口