Determines the action that occurs when the AcceptChanges method is invoked on a DataTable with a ForeignKeyConstraint.
[Visual Basic] Public Enum AcceptRejectRule [C#] public enum AcceptRejectRule [C++] public enum AcceptRejectRule
[JScript] In JScript, you can use the enumerations in the NGWS frameworks, but you cannot define your own.
Member Name | Description |
---|---|
Cascade | Changes are cascaded across the relationship. |
Default | Default action occurs. |
None | No action occurs. |
Namespace: System.Data
Assembly: System.Data.dll
The following example creates a ForeignKeyConstraint, sets various of its properties, including the AcceptRejectRule, 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
System.Data Namespace | DataTable | UniqueConstraint | ForeignKeyConstraint | AcceptRejectRule