Export (0) Print
Expand All
Expand Minimize
0 out of 3 rated this helpful - Rate this topic

DataRowVersion Enumeration

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

Remarks

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:

  • After calling the DataRow object's BeginEdit method, if you change the value, the Current and Proposed values become available.
  • After calling the DataRow object's CancelEdit method, the Proposed value is deleted.
  • After calling the DataRow object's EndEdit method, the Proposed value becomes the Current value.
  • After calling the DataRow object's AcceptChanges method, the Original value becomes identical to the Current value.
  • After calling the DataTable object's AcceptChanges method, the Original value becomes identical to the Current value.
  • After calling the DataRow object's RejectChanges, the Proposed value is discarded, and the version becomes Current.

Members

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.

Example

[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 Language Filter in the upper-left corner of the page.

Requirements

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

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

See Also

System.Data Namespace | AcceptChanges | BeginEdit | EndEdit | Item | RejectChanges

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.