Export (0) Print
Expand All

ForeignKeyConstraint.ForeignKeyConstraint(String, String, String, String[], String[], AcceptRejectRule, Rule, Rule) Constructor

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.

Namespace: System.Data
Assembly: System.Data (in system.data.dll)

public ForeignKeyConstraint (
	string constraintName,
	string parentTableName,
	string parentTableNamespace,
	string[] parentColumnNames,
	string[] childColumnNames,
	AcceptRejectRule acceptRejectRule,
	Rule deleteRule,
	Rule updateRule
)
public ForeignKeyConstraint (
	String constraintName, 
	String parentTableName, 
	String parentTableNamespace, 
	String[] parentColumnNames, 
	String[] childColumnNames, 
	AcceptRejectRule acceptRejectRule, 
	Rule deleteRule, 
	Rule updateRule
)
public function ForeignKeyConstraint (
	constraintName : String, 
	parentTableName : String, 
	parentTableNamespace : String, 
	parentColumnNames : String[], 
	childColumnNames : String[], 
	acceptRejectRule : AcceptRejectRule, 
	deleteRule : Rule, 
	updateRule : Rule
)
Not applicable.

Parameters

constraintName

The name of the constraint.

parentTableName

The name of the parent DataTable that contains parent DataColumn objects in the constraint.

parentTableNamespace

The name of the Namespace.

parentColumnNames

An array of the names of parent DataColumn objects in the constraint.

childColumnNames

An array of the names of child DataColumn objects in the constraint.

acceptRejectRule

One of the AcceptRejectRule values. Possible values include None, Cascade, and Default.

deleteRule

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

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 typeCondition

ArgumentNullException

One or both of the columns is a null reference (Nothing in Visual Basic).

InvalidConstraintException

The columns have different data types.

-Or -

The tables don't belong to the same DataSet.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

.NET Compact Framework

Supported in: 2.0

XNA Framework

Supported in: 1.0

Community Additions

ADD
Show:
© 2014 Microsoft