Describes the version of a DataRow.
[Visual Basic] <Serializable> Public Enum DataRowVersion [C#] [Serializable] public enum DataRowVersion [C++] [Serializable] __value public enum DataRowVersion [JScript] public Serializable enum DataRowVersion
The DataRowVersion values are used when retrieving the value found in a DataRow using Item or the GetChildRows of the DataRow object.
The DataRowVersion informs you what version of a DataRow exists. Versions change under the following circumstances:
| Member name | Description |
|---|---|
| Current
Supported by the .NET Compact Framework. |
The row contains current values. |
| Default
Supported by the .NET Compact Framework. |
The row the default version for the current DataRowState. For a DataRowState value of Added, Modified or Current, the default version is Current. For a DataRowState of Deleted, the version is Original. For a DataRowState value of Detached, the version is Proposed. |
| Original
Supported by the .NET Compact Framework. |
The row contains its original values. |
| Proposed
Supported by the .NET Compact Framework. |
The row contains a proposed value. |
[Visual Basic] The following example checks the DataRowVersion of a DataRow before invoking the AcceptChanges method.
[Visual Basic]
Private Sub CheckVersionBeforeAccept()
Dim r As DataRow
Dim t As DataTable
t = CType(DataGrid1.DataSource, DataTable)
' The user must click a cell to edit in the DataGrid control.
r = t.Rows(DataGrid1.CurrentCell.RowNumber)
r.BeginEdit
' Change the value of column 1 in the row.
r(1) = Edit1.Text
' Compare the proposed version with the current.
If r.HasVersion(datarowversion.Proposed) Then
If r(1, DataRowVersion.Current) Is r(1, DataRowversion.Proposed) Then
MessageBox.Show("The original and the proposed are the same")
r.CancelEdit
Exit Sub
Else
r.AcceptChanges
' Print the original
End If
Else
MessageBox.Show("No new values proposed")
End If
End Sub
[C#, C++, JScript] No example is available for C#, C++, or JScript. To view a Visual Basic example, click the Language Filter button
in the upper-left corner of the page.
Namespace: System.Data
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework - Windows CE .NET
Assembly: System.Data (in System.Data.dll)
System.Data Namespace | AcceptChanges | BeginEdit | EndEdit | Item | RejectChanges