7.14 Identifying Errors in the Table

The GetErrors( ) method returns an array of the rows that contain errors, whether they are constraint violations or failed update attempts. The RowError property or the SetColumnError( ) method of the DataRow object can be used to set an error, or an error can be set by the DataAdapter in response to errors that occur while data is being reconciled with the data source. The HasErrors( ) method should be called prior to calling GetErrors( ) to determine whether the call to GetErrors( ) is necessary. The following example shows how to use these methods:

DataRow[] errorRow;
    errorRows = dt.GetErrors();
    for(Int32 i = 0; i<errorRows.Length; i++)
        // ... resolve the error for the row

        // clear the error for resubmitting

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