Are you blogging on PH? Get your free blog.
*/

Other Views

corner
*/

ADONET FAQ - Updating a Record in a Table Using Dataset

How do I update a record in the table using ADO.Net dataset?

Once you have the UpdateCommand prepared in the data adapter, you can update individual records simply by updating the field values in the data table’s rows. The above code demonstrate how we can update the ‘lines’ field of the third record of the table ‘Article’

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()


Back


corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.
Resource Listings