Each DataRow has a RowState property that can be examined to determine its state.
In the example above, the newly created row's RowState is set to Detached; once it is added to the RowsCollection using the Add method, however, the RowState property becomes New.
The table below identifies the possible states that a row can have.
RowState | Description |
---|---|
Unchanged | No changes have been made since the last call to AcceptChanges. |
New | The row has been added to the table, but AcceptChanges has not been called. |
Modified | Some element of the row has been changed. |
Deleted | The row has been deleted from the table using the Delete method. |
Detached | Either the row has been deleted, but AcceptChanges has not been called; or the row has been created, but not added to the table. |