Describes the version of a DataRow.
[Visual Basic] Public Enum DataRowVersion [C#] public enum DataRowVersion [C++] public enum DataRowVersion
[JScript] In JScript, you can use the enumerations in the NGWS frameworks, but you cannot define your own.
The DataRowVersion values are used when retrieving the value found in a DataRow using the DataRow object's Item property (DataRow indexer)or the GetChildRows
The DataRowVersion informs you what version of a DataRow exists. Versions change under the following circumstances:
Member Name | Description |
---|---|
Current | The row contains current values. |
Default | The row contains its default values. |
Original | The row contains its original values. |
Proposed | The row contains a proposed value. |
Namespace: System.Data
Assembly: System.Data.dll
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 Set t = DataGrid1.DataGridTable.DataTable ' The user must click a cell to edit in the DataGrid control. Set 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) = 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
System.Data Namespace | AcceptChanges | BeginEdit | EndEdit | Item | RejectChanges