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!

DataSet.HasErrors

Gets a value indicating whether there are errors in any of the rows in any of the tables of this DataSet.

[Visual Basic]
Public ReadOnly Property HasErrors As Boolean
[C#]
public bool HasErrors {get;}
[C++]
public: __property bool get_HasErrors();
[JScript]
public function get HasErrors() : Boolean;

Property Value

true if any table has errors;otherwise, false.

Remarks

The HasErrors property is usually consulted after attempting to update a DataSet through the Update method.

Each DataTable in a DataSet also has a HasErrors property. Use the DataSet object's HasErrors to determine if any table has errors before checking individual DataTable objects. If a DataTable has errors, the GetErrors method returns an array of DataRow objects that have errors.

Example [Visual Basic]

The following example uses the HasErrors property to determine whether a DataSet object contains errors. If so, the errors for each DataRow in each DataTable is printed.

[Visual Basic]

Private Sub CheckForErrors()
   If Not DataSet1.HasErrors Then
       DataSet1.Merge DataSet2
   Else
      PrintErrors DataSet1
   End If
End Sub

Private Sub PrintRowErrs(ds As DataSet)
   Dim r As DataRow
   Dim e As DataError
   Dim t As DataTable
   Dim cols() As DataColumn
   For Each t In ds.Tables
      For Each r In t.Rows
         If r.HasErrors Then
Console.WriteLine(r.RowError)
         End If
      Next
   Next
End Sub

See Also

DataSet Class | DataSet Members | System.Data Namespace | GetChanges