DataTable::HasErrors Property

Gets a value indicating whether there are errors in any of the rows in any of the tables of the DataSet to which the table belongs.

Namespace:  System.Data
Assembly:  System.Data (in System.Data.dll)

[BrowsableAttribute(false)]
public:
property bool HasErrors {
	bool get ();
}

Property Value

Type: System::Boolean
true if errors exist; otherwise false.

As users work on a set of data contained in a DataTable, you can mark each change with an error if the change causes some validation failure. You can mark an entire DataRow with an error message using the RowError property. You can also set errors on each column of the row with the SetColumnError method.

Before updating a data source with a DataSet, it's recommended that you first invoke the GetChanges method on the target DataSet. The method results in a DataSet that contains only the changes made to the original. Before sending the DataSet to the data source for updating, check the HasErrors property of each table to see if any errors have been attached to the rows or columns in the rows.

After reconciling each error, clear the errors with the ClearErrors method of the DataRow.

The following example uses the HasErrors property to check if a table contains errors.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

XNA Framework

Supported in: 3.0, 2.0, 1.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft