DataRow.Delete Method ()
.NET Framework (current version)
Deletes the DataRow.
Assembly: System.Data (in System.Data.dll)
| Exception | Condition |
|---|---|
| DeletedRowInaccessibleException | 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.
Note |
|---|
The BeginEdit method temporarily suspends RowChanging events, but the delete operation does not. |
.NET Framework
Available since 1.1
Available since 1.1
Show:
