Tuesday, 13 July 2010

How do I update the physical database with the changes in the dataset?


You can update the physical database by calling the AcceptChanges() method of the data set.

C# Version
DataTable dt = ds.Tables["Article"]; dt.Rows[2]["lines"] = 600; da.Update(ds, "Article"); ds.AcceptChanges(); 


VB.Net Version
Dim dt = ds.Tables("Article") dt.Rows(2)("lines") = 700 da.Update(ds, "Article") ds.AcceptChanges() 


Here ‘da’ and ‘ds’ are the references of the DataAdapter and DataSet objects respectively.

No comments:

Post a Comment