System.Data.ForeignKeyConstraint Class

Represents an action restriction enforced on a set of columns in a primary key/foreign key relationship when a value or row is either deleted or updated.

See Also: ForeignKeyConstraint Members

Syntax

[System.ComponentModel.DefaultProperty("ConstraintName")]
[System.ComponentModel.Editor("Microsoft.VSDesigner.Data.Design.ForeignKeyConstraintEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public class ForeignKeyConstraint : Constraint

Remarks

A System.Data.ForeignKeyConstraint restricts the action performed when a value in a column (or columns) is either deleted or updated. Such a constraint is intended to be used with primary key columns. In a parent/child relationship between two tables, deleting a value from the parent table can affect the child rows in one of the following ways.

System.Data.ForeignKeyConstraint objects are contained in the System.Data.ConstraintCollection of a System.Data.DataTable, which is accessed through the DataTable.Constraints property.

Constraints are not enforced unless the DataSet.EnforceConstraints property is set to true.

The ForeignKeyConstraint.AcceptRejectRule is enforced whenever a System.Data.DataTable object's DataTable.AcceptChanges method is invoked.

Requirements

Namespace: System.Data
Assembly: System.Data (in System.Data.dll)
Assembly Versions: 1.0.3300.0, 1.0.5000.0, 2.0.0.0