Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

DataRow.Delete Method

Deletes the DataRow.

Namespace:  System.Data
Assembly:  System.Data (in System.Data.dll)

member Delete : unit -> unit


The DataRow has already been deleted.

If the RowState of the row is Added, the RowState becomes Detached and the row is removed from the table when you call AcceptChanges.

The RowState becomes Deleted after you use the Delete method on an existing DataRow. It remains Deleted until you call AcceptChanges. At this time, the DataRow is removed from the table.

Delete should not be called in a foreach loop while iterating through a DataRowCollection object. Delete modifies the state of the collection.

A deleted row can be undeleted by invoking RejectChanges.


The BeginEdit method temporarily suspends RowChanging events, but the delete operation does not.

The following example creates a simple DataTable with two columns and ten rows. After deleting several DataRow items with the Delete method, one of the rows is undeleted by invoking RejectChanges.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

XNA Framework

Supported in: 3.0, 2.0, 1.0
© 2015 Microsoft