The DataRowClass
You use an object of theDataRowclass to represent a row. You can also store multiple
DataRow objects in a DataTable. Table 11.4
shows some of theDataRow properties.
Table 11.4: DataRow PROPERTIES
PROPERTY TYPE DESCRIPTION
HasErrors bool Returns a bool value that indicates whether any of the
DataColumn objects in theDataRow have errors.
ItemArray object[] Gets or sets all the DataColumn objects in the DataRow.
RowState DataRowState Gets the current state of the DataRow. The state can be
Added, Deleted, Detached~FT, Modified, or Unchanged.
The state depends in the operation performed on the
DataRow and whether the AcceptChanges() method has
been called to commit the changes.
Table DataTable Gets the DataTable object to which theDataRow belongs.
The row has been created but isn't part of a DataRowCollection object; a DataRow is in
this state immediately after it has been created and before it is added to a collection, or i
f
it has been removed from a collection.
Table 11.5 shows some of theDataRow methods.
Table 11.5: DataRow METHODS
METHOD RETURN
TYPE
DESCRIPTION
AcceptChanges() void Commits all the changes made to theDataRow
object since it was loaded or since the last time the
AcceptChanges() method was called.
BeginEdit() void Starts an edit for theDataRow object.
CancelEdit() void Cancels an edit for theDataRow object and
restores it to the original state.
ClearErrors() void Clears any errors for theDataRow object.
Delete() void Deletes theDataRow object.
EndEdit() void Stops an edit for theDataRow object and commits
the change.
GetChildRows() DataRow[] Overloaded. Returns an array of DataRow objects
Table 11.5: DataRow METHODS
METHOD RETURN
TYPE
DESCRIPTION
that contain the child rows using the specified
DataRelation object.
GetColumnError() string Overloaded. Returns the description of the error
for the specified DataColumn object.
GetColumnsInError() DataColumn[] Returns an array of DataColumn objects that have
errors.
GetParentRow() DataRow Overloaded. Returns a DataRow object that
contains the parent row using the specified
DataRelation object.
GetParentRows() DataRow[] Overloaded. Returns an array of DataRow objects
that contain the parent rows using the specified
DataRelation object.
IsNull() bool Overloaded. Returns a bool value that indicates
whether the specified DataColumn object contains
a null value.
RejectChanges() void Undoes all changes made to theDataRow object
since the AcceptChanges() method was called.
SetNull() void Sets the specified DataColumn object to a null
value.
SetParentRow() void Overloaded. Sets the parent row to the specified
DataRow object.
. the DataRow have errors.
ItemArray object[] Gets or sets all the DataColumn objects in the DataRow.
RowState DataRowState Gets the current state of the.
The DataRow Class
You use an object of the DataRow class to represent a row. You can also store multiple
DataRow objects in a DataTable.