Indicates the action that occurs when a System.Data.ForeignKeyConstraint is enforced.
The System.Data.Rule values are set to the ForeignKeyConstraint.UpdateRule and the ForeignKeyConstraint.DeleteRule properties of a System.Data.ForeignKeyConstraint object found in a System.Data.DataTable object's System.Data.ConstraintCollection.
The System.Data.Rule values determine the action that occurs when a value in a column is either deleted or updated. Of the two, deleting a value is the more critical and demanding of attention when setting a rule.
In the case where a value is deleted, Cascade specifies that all rows containing that value are also deleted. SetNull specifies that values in all child columns are set to null values. SetDefault specifies that all child columns be set to the default value for the column. None specifies that no action will occur, but exceptions are generated.
In the case where a value is updated, Cascade specifies that all child columns are likewise updated with the new value. SetNull specifies that all child columns be set to null values. SetDefault specifies that all child column values be set to the default value. None specifies that no action be taken, but exceptions are generated.
Constraints on a System.Data.DataSet are not enforced unless the DataSet.EnforceConstraints property is true.
When the DataTable.AcceptChanges method is called, the ForeignKeyConstraint.AcceptRejectRule further determines what action occurs.
Member Name | Description |
---|---|
Cascade |
Delete or update related rows. This is the default. |
None |
No action taken on related rows. |
SetDefault |
Set values in related rows to the value contained in the DataColumn.DefaultValue property. |
SetNull |
Set values in related rows to DBNull. |