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.EnforceConstraints

Gets or sets a value indicating whether constraint rules are followed when attempting any update operation.

[Visual Basic]
Public Property EnforceConstraints As Boolean
[C#]
public bool EnforceConstraints {get; set;}
[C++]
public: __property bool get_EnforceConstraints();
public: __property void set_EnforceConstraints(bool);
[JScript]
public function get EnforceConstraints() : Boolean;
public function set EnforceConstraints(Boolean);

Property Value

true, if rules are enforced; otherwise, false.

Exceptions

Exception Type Condition
InvalidConstraintException A constraint isn't applicable.

Remarks

See the Constraints property for more details.

Example [Visual Basic]

The following example sets the EnforceConstraints property to true if any DataTable in a DataSet has at least one constraint.

[Visual Basic]

Private Sub EnforceIfNeeded()
   Dim t As DataTable
   Dim ds As DataSet = New DataSet
   ' Not shown: code to fill the DataSet.
   For Each t in ds.Tables
      If t.Constraints.Count > 0 Then ds.EnforceConstraints = True
   Next
End Sub

See Also

DataSet Class | DataSet Members | System.Data Namespace | Constraints | UniqueConstraint | ForeignKeyConstraint | DataTable