asp.net.ph

DataRow.ClearErrors Method

System.Data Namespace   DataRow Class


Clears the errors for the row, including the RowError and errors set with SetColumnError.

[ VB ]
Public Sub ClearErrors ( )

[ C# ]
void ClearErrors ( );

[ C++ ]
public: void ClearErrors ( );

[ JScript ]
public function ClearErrors ( );

Remarks

Use SetColumnError and GetColumnError to set and return errors for individual columns.

Set the RowError property to set an error that applies to the whole row.

To determine if any errors exist for the columns collection, use the HasErrors method. Consequently, you can use the GetColumnsInError method to retrieve all of the columns with errors.

Example

The following example first uses the HasErrors property to check for errors. If the row has errors, the GetColumnsInError method returns the array of columns with errors which can then be resolved. The ClearErrors method is then called to clear all errors.

private void GetAllErrs ( DataRow myRow ) {
   // check if the row has errors
   if ( myRow.HasErrors ) {
      // get the array of columns in error.
      DataColumn [ ] colArr = myRow.GetColumnsInError ( );

     for ( int i = 0; i < colArr.Length; i++ ) {
         // insert code to fix errors on each column.
         Response.Write ( colArr [ ].ColumnName );
      }
      // clear errors after reconciling.
      myRow.ClearErrors ( );
   }
}
  C# VB

See Also

DataRow Members   ColumnsCollection   GetColumnError   GetColumnsInError   HasErrors   SetColumnError   RowError Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph