Indicates what kind of action should take place across this constraint when AcceptChanges is invoked.
[Visual Basic] Overridable Public Property AcceptRejectRule As AcceptRejectRule [C#] public AcceptRejectRule AcceptRejectRule {virtual get; virtual set;} [C++] public: __property virtual AcceptRejectRule get_AcceptRejectRule(); public: __property virtual void set_AcceptRejectRule(AcceptRejectRule); [JScript] public function get AcceptRejectRule() : AcceptRejectRule; public function set AcceptRejectRule(AcceptRejectRule);
One of the AcceptRejectRule values. Possible values include None, Cascade, and Default.
Changes to a DataRow or DataTable are not final until the Accept method is invoked. At that point, the AcceptRejectRule will determine the course of action on any values that have been changed or deleted.
The following example creates a ForeignKeyConstraint, sets its AcceptRejectRule, and adds the constraint 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
ForeignKeyConstraint Class | ForeignKeyConstraint Members | System.Data Namespace | AcceptRejectRule