ForeignKeyConstraint Oluşturucular
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
ForeignKeyConstraint sınıfının yeni bir örneğini başlatır.
Aşırı Yüklemeler
| Name | Description |
|---|---|
| ForeignKeyConstraint(DataColumn, DataColumn) |
Belirtilen üst ve alt ForeignKeyConstraint nesnelerle sınıfının yeni bir örneğini DataColumn başlatır. |
| ForeignKeyConstraint(DataColumn[], DataColumn[]) |
Belirtilen üst ve alt ForeignKeyConstraint nesne dizileriyle sınıfının yeni bir örneğini DataColumn başlatır. |
| ForeignKeyConstraint(String, DataColumn, DataColumn) |
Belirtilen ad, üst ve alt ForeignKeyConstraint nesnelerle sınıfın yeni bir örneğini DataColumn başlatır. |
| ForeignKeyConstraint(String, DataColumn[], DataColumn[]) |
Sınıfın ForeignKeyConstraint yeni bir örneğini belirtilen adla ve üst ve alt DataColumn nesne dizileriyle başlatır. |
| ForeignKeyConstraint(String, String, String[], String[], AcceptRejectRule, Rule, Rule) |
Bu oluşturucu, Visual Studio ortamında tasarım zamanı desteği için sağlanır. Bu oluşturucu kullanılarak oluşturulan ForeignKeyConstraint nesnelerin AddRange(Constraint[])aracılığıyla koleksiyona eklenmesi gerekir. Belirtilen adlara sahip tablolar ve sütunlar yöntemi çağrılırken mevcut olmalıdır veya bu oluşturucu çağrılmadan önce çağrıldıysa BeginInit() , belirtilen adlara sahip tablo ve sütunların EndInit() çağrılan zamanda mevcut olması gerekir. |
| ForeignKeyConstraint(String, String, String, String[], String[], AcceptRejectRule, Rule, Rule) |
Bu oluşturucu, Visual Studio ortamında tasarım zamanı desteği için sağlanır. Bu oluşturucu kullanılarak oluşturulan ForeignKeyConstraint nesnelerin AddRange(Constraint[])aracılığıyla koleksiyona eklenmesi gerekir. Belirtilen adlara sahip tablolar ve sütunlar yöntemi çağrılırken mevcut olmalıdır veya bu oluşturucu çağrılmadan önce çağrıldıysa BeginInit() , belirtilen adlara sahip tablo ve sütunların EndInit() çağrılan zamanda mevcut olması gerekir. |
ForeignKeyConstraint(DataColumn, DataColumn)
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
Belirtilen üst ve alt ForeignKeyConstraint nesnelerle sınıfının yeni bir örneğini DataColumn başlatır.
public:
ForeignKeyConstraint(System::Data::DataColumn ^ parentColumn, System::Data::DataColumn ^ childColumn);
public ForeignKeyConstraint(System.Data.DataColumn parentColumn, System.Data.DataColumn childColumn);
new System.Data.ForeignKeyConstraint : System.Data.DataColumn * System.Data.DataColumn -> System.Data.ForeignKeyConstraint
Public Sub New (parentColumn As DataColumn, childColumn As DataColumn)
Parametreler
- parentColumn
- DataColumn
Kısıtlamadaki üst DataColumn öğe.
- childColumn
- DataColumn
Kısıtlamadaki çocuk DataColumn .
Özel durumlar
Sütunlardan biri veya her ikisi de şeklindedir null.
Örnekler
Aşağıdaki örnek yeni ForeignKeyConstraintbir oluşturur, özelliklerinden bazılarını ayarlar ve bir DataTable nesnenin ConstraintCollectionöğesine ekler.
' The next line goes into the Declarations section.
' SuppliersProducts is a class derived from DataSet.
Private suppliersProducts As SuppliersProducts
Private Sub CreateConstraint()
' Declare parent column and child column variables.
Dim parentColumn As DataColumn
Dim childColumn As DataColumn
Dim fkConstraint As ForeignKeyConstraint
' Set parent and child column variables.
parentColumn = _
suppliersProducts.Tables("Suppliers").Columns("SupplierID")
childColumn = _
suppliersProducts.Tables("Products").Columns("SupplieriD")
fkConstraint = New ForeignKeyConstraint(parentColumn, childColumn)
' Set various properties of the constraint.
With fkConstraint
.ConstraintName = "suppierFKConstraint"
.DeleteRule = Rule.SetNull
.UpdateRule = Rule.Cascade
.AcceptRejectRule = AcceptRejectRule.Cascade
End With
' Add the constraint, and set EnforceConstraints to true.
suppliersProducts.Tables("Products").Constraints.Add(fkConstraint)
suppliersProducts.EnforceConstraints = True
End Sub
Şunlara uygulanır
ForeignKeyConstraint(DataColumn[], DataColumn[])
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
Belirtilen üst ve alt ForeignKeyConstraint nesne dizileriyle sınıfının yeni bir örneğini DataColumn başlatır.
public:
ForeignKeyConstraint(cli::array <System::Data::DataColumn ^> ^ parentColumns, cli::array <System::Data::DataColumn ^> ^ childColumns);
public ForeignKeyConstraint(System.Data.DataColumn[] parentColumns, System.Data.DataColumn[] childColumns);
new System.Data.ForeignKeyConstraint : System.Data.DataColumn[] * System.Data.DataColumn[] -> System.Data.ForeignKeyConstraint
Public Sub New (parentColumns As DataColumn(), childColumns As DataColumn())
Parametreler
- parentColumns
- DataColumn[]
Kısıtlamadaki bir üst DataColumn dizi.
- childColumns
- DataColumn[]
Kısıtlamadaki bir alt DataColumn dizi.
Özel durumlar
Sütunlardan biri veya her ikisi de şeklindedir null.
Örnekler
Aşağıdaki örnek yeni ForeignKeyConstraintbir oluşturur, özelliklerinden bazılarını ayarlar ve bir DataTable nesnenin ConstraintCollectionöğesine ekler.
' The next line goes into the Declarations section.
' SuppliersProducts is a class derived from DataSet.
Private suppliersProducts As SuppliersProducts
Private Sub CreateConstraint()
' Declare parent column and child column variables.
Dim parentColumns(1) As DataColumn
Dim childColumns(1) As DataColumn
Dim fkConstraint As ForeignKeyConstraint
' Set parent and child column variables.
parentColumns(0) = _
suppliersProducts.Tables("OrderDetails").Columns("OrderID")
parentColumns(1) = _
suppliersProducts.Tables("OrderDetails").Columns("ProductID")
childColumns(0) = _
suppliersProducts.Tables("Sales").Columns("OrderID")
childColumns(1) = _
suppliersProducts.Tables("Sales").Columns("ProductID")
fkConstraint = _
New ForeignKeyConstraint(parentColumns, childColumns)
' Set various properties of the constraint.
With fkConstraint
.ConstraintName = "ProductSalesOrders"
.DeleteRule = Rule.SetDefault
.UpdateRule = Rule.Cascade
.AcceptRejectRule = AcceptRejectRule.Cascade
End With
' Add the constraint, and set EnforceConstraints to true.
suppliersProducts.Tables( _
"OrderDetails").Constraints.Add(fkConstraint)
suppliersProducts.EnforceConstraints = True
End Sub
Şunlara uygulanır
ForeignKeyConstraint(String, DataColumn, DataColumn)
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
Belirtilen ad, üst ve alt ForeignKeyConstraint nesnelerle sınıfın yeni bir örneğini DataColumn başlatır.
public:
ForeignKeyConstraint(System::String ^ constraintName, System::Data::DataColumn ^ parentColumn, System::Data::DataColumn ^ childColumn);
public ForeignKeyConstraint(string? constraintName, System.Data.DataColumn parentColumn, System.Data.DataColumn childColumn);
public ForeignKeyConstraint(string constraintName, System.Data.DataColumn parentColumn, System.Data.DataColumn childColumn);
new System.Data.ForeignKeyConstraint : string * System.Data.DataColumn * System.Data.DataColumn -> System.Data.ForeignKeyConstraint
Public Sub New (constraintName As String, parentColumn As DataColumn, childColumn As DataColumn)
Parametreler
- constraintName
- String
Kısıtlamanın adı.
- parentColumn
- DataColumn
Kısıtlamadaki üst DataColumn öğe.
- childColumn
- DataColumn
Kısıtlamadaki çocuk DataColumn .
Özel durumlar
Sütunlardan biri veya her ikisi de şeklindedir null.
Örnekler
Aşağıdaki örnek yeni ForeignKeyConstraintbir oluşturur, özelliklerinden bazılarını ayarlar ve bir DataTable nesnenin ConstraintCollectionöğesine ekler.
' The next line goes into the Declarations section of the module:
' SuppliersProducts is a class derived from DataSet.
Private suppliersProducts As SuppliersProducts
Private Sub CreateConstraint()
' Declare parent column and child column variables.
Dim parentColumn As DataColumn
Dim childColumn As DataColumn
Dim fkeyConstraint As ForeignKeyConstraint
' Set parent and child column variables.
parentColumn = _
suppliersProducts.Tables("Suppliers").Columns("SupplierID")
childColumn = _
suppliersProducts.Tables("Products").Columns("SupplierID")
fkeyConstraint = New ForeignKeyConstraint( _
"SupplierFKConstraint", parentColumn, childColumn)
' Set various properties of the constraint.
With fkeyConstraint
.DeleteRule = Rule.SetNull
.UpdateRule = Rule.Cascade
.AcceptRejectRule = AcceptRejectRule.Cascade
End With
' Add the constraint, and set EnforceConstraints to true.
suppliersProducts.Tables("Products").Constraints.Add(fkeyConstraint)
suppliersProducts.EnforceConstraints = True
End Sub
Şunlara uygulanır
ForeignKeyConstraint(String, DataColumn[], DataColumn[])
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
Sınıfın ForeignKeyConstraint yeni bir örneğini belirtilen adla ve üst ve alt DataColumn nesne dizileriyle başlatır.
public:
ForeignKeyConstraint(System::String ^ constraintName, cli::array <System::Data::DataColumn ^> ^ parentColumns, cli::array <System::Data::DataColumn ^> ^ childColumns);
public ForeignKeyConstraint(string? constraintName, System.Data.DataColumn[] parentColumns, System.Data.DataColumn[] childColumns);
public ForeignKeyConstraint(string constraintName, System.Data.DataColumn[] parentColumns, System.Data.DataColumn[] childColumns);
new System.Data.ForeignKeyConstraint : string * System.Data.DataColumn[] * System.Data.DataColumn[] -> System.Data.ForeignKeyConstraint
Public Sub New (constraintName As String, parentColumns As DataColumn(), childColumns As DataColumn())
Parametreler
- constraintName
- String
öğesinin ForeignKeyConstraintadı. Dize boşsa veya boşsa null , kısıtlamalar koleksiyonuna eklendiğinde varsayılan bir ad verilir.
- parentColumns
- DataColumn[]
Kısıtlamadaki bir üst DataColumn dizi.
- childColumns
- DataColumn[]
Kısıtlamadaki bir alt DataColumn dizi.
Özel durumlar
Sütunlardan biri veya her ikisi de şeklindedir null.
Örnekler
Aşağıdaki örnek yeni ForeignKeyConstraintbir oluşturur, özelliklerinden bazılarını ayarlar ve bir DataTable nesnenin ConstraintCollectionöğesine ekler.
Private Sub CreateConstraint(ByVal suppliersProducts As DataSet)
' Declare parent column and child column variables.
Dim parentColumns(1) As DataColumn
Dim childColumns(1) As DataColumn
Dim fkConstraint As ForeignKeyConstraint
' Set parent and child column variables.
parentColumns(0) = _
suppliersProducts.Tables("OrderDetails").Columns("OrderID")
parentColumns(1) = _
suppliersProducts.Tables("OrderDetails").Columns("ProductID")
childColumns(0) = _
suppliersProducts.Tables("Sales").Columns("OrderID")
childColumns(1) = _
suppliersProducts.Tables("Sales").Columns("ProductID")
fkConstraint = New ForeignKeyConstraint( _
"ProductSalesOrders", parentColumns, childColumns)
' Set various properties of the constraint.
With fkConstraint
.DeleteRule = Rule.SetDefault
.UpdateRule = Rule.Cascade
.AcceptRejectRule = AcceptRejectRule.Cascade
End With
' Add the constraint, and set EnforceConstraints to true.
suppliersProducts.Tables("OrderDetails").Constraints.Add( _
fkConstraint)
suppliersProducts.EnforceConstraints = True
End Sub
Şunlara uygulanır
ForeignKeyConstraint(String, String, String[], String[], AcceptRejectRule, Rule, Rule)
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
Bu oluşturucu, Visual Studio ortamında tasarım zamanı desteği için sağlanır. Bu oluşturucu kullanılarak oluşturulan ForeignKeyConstraint nesnelerin AddRange(Constraint[])aracılığıyla koleksiyona eklenmesi gerekir. Belirtilen adlara sahip tablolar ve sütunlar yöntemi çağrılırken mevcut olmalıdır veya bu oluşturucu çağrılmadan önce çağrıldıysa BeginInit() , belirtilen adlara sahip tablo ve sütunların EndInit() çağrılan zamanda mevcut olması gerekir.
public:
ForeignKeyConstraint(System::String ^ constraintName, System::String ^ parentTableName, cli::array <System::String ^> ^ parentColumnNames, cli::array <System::String ^> ^ childColumnNames, System::Data::AcceptRejectRule acceptRejectRule, System::Data::Rule deleteRule, System::Data::Rule updateRule);
[System.ComponentModel.Browsable(false)]
public ForeignKeyConstraint(string? constraintName, string? parentTableName, string[] parentColumnNames, string[] childColumnNames, System.Data.AcceptRejectRule acceptRejectRule, System.Data.Rule deleteRule, System.Data.Rule updateRule);
[System.ComponentModel.Browsable(false)]
public ForeignKeyConstraint(string constraintName, string parentTableName, string[] parentColumnNames, string[] childColumnNames, System.Data.AcceptRejectRule acceptRejectRule, System.Data.Rule deleteRule, System.Data.Rule updateRule);
[<System.ComponentModel.Browsable(false)>]
new System.Data.ForeignKeyConstraint : string * string * string[] * string[] * System.Data.AcceptRejectRule * System.Data.Rule * System.Data.Rule -> System.Data.ForeignKeyConstraint
Public Sub New (constraintName As String, parentTableName As String, parentColumnNames As String(), childColumnNames As String(), acceptRejectRule As AcceptRejectRule, deleteRule As Rule, updateRule As Rule)
Parametreler
- constraintName
- String
Kısıtlamanın adı.
- parentTableName
- String
Kısıtlamada üst DataTable nesneleri içeren üst DataColumn öğe adı.
- parentColumnNames
- String[]
Kısıtlamadaki üst DataColumn nesnelerin adlarının dizisi.
- childColumnNames
- String[]
Kısıtlamadaki alt DataColumn nesnelerin adlarının dizisi.
- acceptRejectRule
- AcceptRejectRule
Değerlerden AcceptRejectRule biri. Olası değerler , Noneve Cascadedeğerlerini içerirDefault.
- deleteRule
- Rule
Rule Satır silindiğinde kullanılacak değerlerden biri. Varsayılan değer: Cascade. Olası değerler şunlardır: None, Cascade, SetNull, SetDefaultve Default.
- updateRule
- Rule
Rule Satır güncelleştirildiğinde kullanılacak değerlerden biri. Varsayılan değer: Cascade. Olası değerler şunlardır: None, Cascade, SetNull, SetDefaultve Default.
- Öznitelikler
Özel durumlar
Sütunlardan biri veya her ikisi de şeklindedir null.
Şunlara uygulanır
ForeignKeyConstraint(String, String, String, String[], String[], AcceptRejectRule, Rule, Rule)
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
- Kaynak:
- ForeignKeyConstraint.cs
Bu oluşturucu, Visual Studio ortamında tasarım zamanı desteği için sağlanır. Bu oluşturucu kullanılarak oluşturulan ForeignKeyConstraint nesnelerin AddRange(Constraint[])aracılığıyla koleksiyona eklenmesi gerekir. Belirtilen adlara sahip tablolar ve sütunlar yöntemi çağrılırken mevcut olmalıdır veya bu oluşturucu çağrılmadan önce çağrıldıysa BeginInit() , belirtilen adlara sahip tablo ve sütunların EndInit() çağrılan zamanda mevcut olması gerekir.
public:
ForeignKeyConstraint(System::String ^ constraintName, System::String ^ parentTableName, System::String ^ parentTableNamespace, cli::array <System::String ^> ^ parentColumnNames, cli::array <System::String ^> ^ childColumnNames, System::Data::AcceptRejectRule acceptRejectRule, System::Data::Rule deleteRule, System::Data::Rule updateRule);
[System.ComponentModel.Browsable(false)]
public ForeignKeyConstraint(string? constraintName, string? parentTableName, string? parentTableNamespace, string[] parentColumnNames, string[] childColumnNames, System.Data.AcceptRejectRule acceptRejectRule, System.Data.Rule deleteRule, System.Data.Rule updateRule);
[System.ComponentModel.Browsable(false)]
public ForeignKeyConstraint(string constraintName, string parentTableName, string parentTableNamespace, string[] parentColumnNames, string[] childColumnNames, System.Data.AcceptRejectRule acceptRejectRule, System.Data.Rule deleteRule, System.Data.Rule updateRule);
[<System.ComponentModel.Browsable(false)>]
new System.Data.ForeignKeyConstraint : string * string * string * string[] * string[] * System.Data.AcceptRejectRule * System.Data.Rule * System.Data.Rule -> System.Data.ForeignKeyConstraint
Public Sub New (constraintName As String, parentTableName As String, parentTableNamespace As String, parentColumnNames As String(), childColumnNames As String(), acceptRejectRule As AcceptRejectRule, deleteRule As Rule, updateRule As Rule)
Parametreler
- constraintName
- String
Kısıtlamanın adı.
- parentTableName
- String
Kısıtlamada üst DataTable nesneleri içeren üst DataColumn öğe adı.
- parentColumnNames
- String[]
Kısıtlamadaki üst DataColumn nesnelerin adlarının dizisi.
- childColumnNames
- String[]
Kısıtlamadaki alt DataColumn nesnelerin adlarının dizisi.
- acceptRejectRule
- AcceptRejectRule
Değerlerden AcceptRejectRule biri. Olası değerler , Noneve Cascadedeğerlerini içerirDefault.
- deleteRule
- Rule
Rule Satır silindiğinde kullanılacak değerlerden biri. Varsayılan değer: Cascade. Olası değerler şunlardır: None, Cascade, SetNull, SetDefaultve Default.
- updateRule
- Rule
Rule Satır güncelleştirildiğinde kullanılacak değerlerden biri. Varsayılan değer: Cascade. Olası değerler şunlardır: None, Cascade, SetNull, SetDefaultve Default.
- Öznitelikler
Özel durumlar
Sütunlardan biri veya her ikisi de şeklindedir null.