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!

DataTable.GetErrors

Returns an array of DataRow objects that contain errors.

[Visual Basic]
Public Function GetErrors() As DataRow ()
[C#]
public DataRow[] GetErrors();
[C++]
public: DataRow* GetErrors() [];
[JScript]
public function GetErrors() : DataRow[];

Return Value

An array of DataRow objects that have errors.

Remarks

Invoke GetErrors after invoking the DataSet class's Update method. Also, be sure you don't invoke the AcceptChanges on the DataTable until after all errors have been succesfully resolved, and the DataSet re-submitted for updating.

Example [Visual Basic]

The following example uses the GetErrors method to return an array of DataRow objects that have errors.

[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

DataTable Class | DataTable Members | System.Data Namespace | AcceptChanges | HasErrors