System.Data Namespace DataRow Class
Returns the specified version of data in the given column index.
Object variable = DataRow.Item [ columnIndex, version ];
... or ...
Object variable = DataRow [ columnIndex, version ];
dim variable as Object = DataRow.Item ( columnIndex, version )
... or ...
dim variable as Object = DataRow ( columnIndex, version )
variable : Object = DataRow.Item ( columnIndex, version );
... or ...
variable : Object = DataRow ( columnIndex, version ); |
|
C# |
VB |
JScript |
- columnIndex
- The zero-based index of the column.
- version
- One of the DataRowVersion values that specifies the desired row version. Possible values are Default, Original, Current, and Proposed.
An Object that contains the data.
You can only create or update a row after calling the BeginEdit method; similarly, the EndEdit method must be called to commit the edit. After calling the EndEdit method, and before calling the AcceptChanges method, internal representations of the original and new proposed values are stored. Therefore, until you call the AcceptChanges, you can use the version argument to specify which version of a column's value you need, either the DataRowVersion.Original or DataRowVersion.Proposed. Once you call the AcceptChanges method, however, the version of the column reverts to DataRowVersion.Original. If the row is new, you can also pass DataRowVersion.Default for the parameter to retrieve the column's default value. When passing DataRowVersion.Current, the property will return the current value, whatever its version may be.
NOTE: the BeginEdit method is called implicitly when you change the value of a databound control or when a DataRow object is added to the DataRowCollection; the EndEdit method is called implicitly when calling the following methods: the DataRow object's AcceptChanges method, the DataTable object's AcceptChanges method, or the CancelEdit method.
By contrast, the DataRowVersion enumeration Current returns the version of the data after the EndEdit method has been called.
The version argument shouldn't be confused with the RowState property. The version argument describes the state of the data contained by the column in relation to the column's original value. The RowState property describes the state of the entire row in relation to its parent DataTable.
When setting the property, an exception will be thrown if an exception occurs in the ColumnChanging event.
If this is an immediate edit, see EndEdit for the exceptions that can be thrown.
DataRow Members DataRow.Item Overload List