NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DataRow.GetColumnError (DataColumn)

Gets the error description of the specified DataColumn.

[Visual Basic]
Overloads Public Function GetColumnError( _
   ByVal column As DataColumn _
) As String
[C#]
public string GetColumnError(
   DataColumn column
);
[C++]
public: String* GetColumnError(
   DataColumn* column
);
[JScript]
public function GetColumnError(
   column : DataColumn
) : String;

Parameters

column
A DataColumn.

Return Value

The text of the error description.

Remarks

Use the SetColumnError method to set column errors.

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. Alternatively, the GetErrors method of the DataTable returns all rows with errors.

To clear all errors for the columns collection, use the ClearErrors method.

Example [Visual Basic]

The following example gets the error description for each column in each DataTable of a DataSet.

[Visual Basic]

Private Sub PrintAllErrs()
   Dim rowsInError() As DataRow
   Dim t As DataTable
   Dim ds As DataSet
   Dim i As Integer
   Dim c As DataColumn
   ds = DataSet1
   
   For Each t in ds.Tables
      ' Test if the table has errors. If not, skip it.
      If t.HasErrors Then
         ' Get an array of all rows with errors.
         rowsInError = t.GetErrors
         ' Print the error of each column in each row.
For i = 0 To UBound(rowsInError)
   For Each c In t.Columns
      Console.WriteLine(c.ColumnName, rowsInError(i).GetColumnError(c))
   Next c
   ' Clear the row errors
   rowsInError(i).ClearErrors
Next i
      End If
   Next t
End Sub

See Also

DataRow Class | DataRow Members | System.Data Namespace | DataRow.GetColumnError Overload List | ClearErrors | ColumnsCollection | Contains | DataColumn | Error | GetColumnsInError | GetErrors | HasErrors | RowError | SetColumnError