The RowState is a description of the rows connection to a DataTable and whether the data is changed.
The different DataRowVersion contains the different versions of the data, and can either be: Current, Original, Proposed or a pointer to one of the three (it is usually denoted as the Default).
And finally a DataRow can be in Edit Mode or not. A DataRow enters and exits this mode when BeginEdit and EndEdit is invoked respectively.
The lifetime of a DataRow can pass through these RowStates:
- Detatched: The DataRow is created but not attached to any DataTable.
- Added: The RowState goes to Added when it is added to a DataTable.
- Unchanged: If the
AcceptChangesmethod is invoked, the RowState becomes Unchanged.
- Modified: If the data is modified the RowState becomes Modified, this is however not true if the current RowState is Added.
- Deleted: When the
Deletemethod is invoked.
Strangely enough the DataRowVersions doesnt really have anything to do with the RowState, but whether the DataRow is in Edit Mode or not(or well in RowState Deleted.
Before an Edit the default data in the row is found in Current version. In edit mode the default data will be in the Proposed version, while the current version contains the unedited version.
After an Edit the Original version contains the data from before the edit, while the Current version contains the hmm... current version (in other words the Proposed version in Edit mode).