25.1 Comments/Troubleshooting

The commonly used public properties of the DataRow class are listed in Table 25-1.

Table 25-1. DataRow properties

Property

Description

HasErrors

Gets a value indicating whether there are errors in the row.

RowError

Gets or sets a value containing the error description text for a row.

RowState

Gets the current row state.

Table

Gets the table that the row belongs to and has a schema for.

The commonly used public collections of the DataRow class are listed in Table 25-2.

Table 25-2. DataRow collection

Collection

Description

ItemArray

Gets or sets the values for the columns in the row as an object array.

The commonly used public methods of the DataRow class are listed in Table 25-3.

Table 25-3. DataRow methods

Method

Description

AcceptChanges(  )

Commits all changes made to the row since the last time it was loaded or since the last time changes were committed.

BeginEdit(  )

Puts the row into edit mode, suspending the events that trigger validation rules.

CancelEdit(  )

Cancels the edit on the row, discarding any changes.

ClearErrors(  )

Clears both row and column errors for the row.

Delete(  )

If the row is newly added, it is removed from the table. Otherwise, the row is marked for deletion.

EndEdit(  )

Ends the edit on the row, committing the changes made.

GetChildRows(  )

Gets an array of child rows for the row, based on a specified relationship.

GetColumnError(  )

Gets the error description for a specified column in the row.

GetColumnsInError(  )

Gets the array of columns in the row having errors.

GetParentRow(  )

Gets the parent row for the row, based on a relation.

GetParentRows(  )

Gets an array of rows that are the parent rows of the row, based on a specified relationship.

HasVersion(  )

Returns a value indicating whether the specified version of the row exists.

IsNull(  )

Returns a value indicating whether the specified column in the row contains a null value.

RejectChanges(  )

Rejects all changes made to the row since the last time it was loaded or since the last time changes were committed.

SetColumnError(  )

Sets the error description for a specified column in the row.

SetParentRow(  )

Sets the parent row of the row to the specified row.

The DataRow class is contained within the System.Data namespace. The DataRow class is safe for multithreaded read operations; multithreaded write operations must be synchronized. DataRow objects can't be passed between different application domains.



    Part I: ADO.NET Tutorial
    Part II: ADO.NET Core Classes
    Part III: API Quick Reference