asp.net.ph

DataRow.GetColumnsInError Method

System.Data Namespace   DataRow Class


Returns an array of columns that have errors.

[ VB ]
Public Function GetColumnsInError ( ) As DataColumn ( )

[ C# ]
public DataColumn [ ] GetColumnsInError ( );

[ C++ ]
public: DataColumn* GetColumnsInError ( ) [ ];

[ JScript ]
public function GetColumnsInError ( ) : DataColumn [ ];

Return Value

An array of DataColumn objects that contain errors.

Remarks

The GetColumnsInError allows you to reduce the number of DataColumn objects that must be processed for errors by returning only those columns that have an error. Errors can be set to individual columns with the SetColumnError method. To further reduce the number of processing, check the DataRow class's HasErrors property to first determine if a DataRow has errors before invoking GetColumnsInError.

Use the ClearErrors method to clear all errors on the row, including the RowError.

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   ClearErrors   GetColumnError   GetErrors   HasErrors   RowError   SetColumnError 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