ForeignKeyConstraint Constructor (String^, String^, array<String^>^, array<String^>^, AcceptRejectRule, Rule, Rule)
This constructor is provided for design time support in the Visual Studio environment. ForeignKeyConstraint objects created by using this constructor must then be added to the collection via AddRange. Tables and columns with the specified names must exist at the time the method is called, or if BeginInit has been called prior to calling this constructor, the tables and columns with the specified names must exist at the time that EndInit is called.
Assembly: System.Data (in System.Data.dll)
public: [BrowsableAttribute(false)] ForeignKeyConstraint( String^ constraintName, String^ parentTableName, array<String^>^ parentColumnNames, array<String^>^ childColumnNames, AcceptRejectRule acceptRejectRule, Rule deleteRule, Rule updateRule )
Parameters
- constraintName
-
Type:
System::String^
The name of the constraint.
- parentTableName
-
Type:
System::String^
The name of the parent DataTable that contains parent DataColumn objects in the constraint.
- parentColumnNames
-
Type:
array<System::String^>^
An array of the names of parent DataColumn objects in the constraint.
- childColumnNames
-
Type:
array<System::String^>^
An array of the names of child DataColumn objects in the constraint.
- acceptRejectRule
-
Type:
System.Data::AcceptRejectRule
One of the AcceptRejectRule values. Possible values include None, Cascade, and Default.
- deleteRule
-
Type:
System.Data::Rule
One of the Rule values to use when a row is deleted. The default is Cascade. Possible values include: None, Cascade, SetNull, SetDefault, and Default.
- updateRule
-
Type:
System.Data::Rule
One of the Rule values to use when a row is updated. The default is Cascade. Possible values include: None, Cascade, SetNull, SetDefault, and Default.
| Exception | Condition |
|---|---|
| ArgumentNullException | One or both of the columns is null. |
| InvalidConstraintException |
Available since 1.1