|
|
You use an object of the DataRow class to represent a row. You can also store multiple DataRow objects in a DataTable. Table 11.4 shows some of the DataRow properties.
PROPERTY | TYPE | DESCRIPTION |
---|---|---|
HasErrors | bool | Returns a bool value that indicates whether any of the DataColumn objects in the DataRow 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 the DataRow 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 if it has been removed from a collection. |
Table 11.5 shows some of the DataRow methods.
METHOD | RETURN TYPE | DESCRIPTION |
---|---|---|
AcceptChanges() | void | Commits all the changes made to the DataRow object since it was loaded or since the last time the AcceptChanges() method was called. |
BeginEdit() | void | Starts an edit for the DataRow object. |
CancelEdit() | void | Cancels an edit for the DataRow object and restores it to the original state. |
ClearErrors() | void | Clears any errors for the DataRow object. |
Delete() | void | Deletes the DataRow object. |
EndEdit() | void | Stops an edit for the DataRow object and commits the change. |
GetChildRows() | DataRow[] | Overloaded. Returns an array of DataRow objects 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 the DataRow 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. |
|
|