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!

ForeignKeyConstraint.UpdateRule

Gets or sets the action that occurs across this constraint on when a row is deleted.

[Visual Basic]
Overridable Public Property UpdateRule As Rule
[C#]
public Rule UpdateRule {virtual get; virtual set;}
[C++]
public: __property virtual Rule get_UpdateRule();
public: __property virtual void set_UpdateRule(Rule);
[JScript]
public function get UpdateRule() : Rule;
public function set UpdateRule(Rule);

Property Value

One of the Rule values. The default is Cascade.

Example [Visual Basic]

The following example creates a ForeignKeyConstraint, sets various of its properties, and adds it to a DataTable object's ConstraintsCollection.

[Visual Basic]

' The next line goes into the Declarations section of the module:
' SuppliersProducts is a class derived from DataSet.
Private myDataSet As SuppliersProducts 


Private Sub CreateConstraint()
   ' Declare parent column and child column variables.
   Dim pCol As DataColumn
   Dim cCol As DataColumn
   Dim myFKC As ForeignKeyConstraint
   ' Set parent and child column variables.
   pCol = MyDataSet.Tables("Suppliers).Columns("SupplierID")
   cCol = MyDataSet.Tables("Products").Columns("SupplieriD")
   myFKC = New ForeignKeyConstraint("SuppierFKConstraint", pCol, cCol)
   ' Set null values when a value is deleted.
   myFKC.DeleteRule = Rule.SetNull
   myFKC.UpdateRule = Rule.Cascade
   myFKC.AcceptRejectRule = AcceptRejectRule.Cascade
   ' Add the constraint, and set EnforceConstraints to true.
   myDataSet.Tables("Suppliers").Constraints.Add myFKC
   myDataSet.EnforceConstraints = True
End Sub

See Also

ForeignKeyConstraint Class | ForeignKeyConstraint Members | System.Data Namespace | AcceptRejectRule | Rule