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

To delete a record, you first get the DataRow object from the DataTable object. Then you simply call the Delete() method of the data row object to delete a record from the data table.

C# Version
DataTable dt = ds.Tables["Article"];
			
// Delete
DataRow dr = dt.Rows[3];
dr.Delete();
da.Update(ds, "Article");
ds.AcceptChanges();


VB.Net Version
Dim dt As DataTable
dt = ds.Tables("Article")
' Delete
Dim dr As DataRow
dr = dt.Rows(3)
dr.Delete()
da.Update(ds, "Article")
ds.AcceptChanges()


Back



 
Printer friendly version of the FAQ-ADONET-Delete-Record-Using-Dataset page


Sponsored links

.Net Application Updating
One easy to use component adds safe and reliable updating features. Download today for a free trial.
BugSplat - Automatic Crash Analysis
Fast online exception analysis. Capture customer crash data online.
.Net Localization Tool Sisulizer
Localize your .Net apps: ResX and assemblies. Database, XML & HTML Help localization. Try Sisulizer!
CSTSOFT Instrumentation .NET & ActiveX Components
A collection of 13 instrumentation .NET/ActiveX/VCL components including Gauge,Knob,LED,Trend etc.
Web based bug tracking - AdminiTrack.com
AdminiTrack offers an effective web-based bug tracking system designed for professional software development teams.

Advertisement



Free Magazine

Free Magazines
eWeek The essential technology information source for builders of e-business.... subscribe now

Newsletter | Submit Content | About | Advertising | Awards | Contact Us | Link to us |
© 1996-2008 Community Networks Ltd 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 Terms Of Use and Privacy Statement for more information. Development by Synchron Data - .NET development.