DataRelation.ChildKeyConstraint DataRelation.ChildKeyConstraint DataRelation.ChildKeyConstraint DataRelation.ChildKeyConstraint Property

Definizione

Ottiene l'oggetto ForeignKeyConstraint per la relazione.Gets the ForeignKeyConstraint for the relation.

public:
 virtual property System::Data::ForeignKeyConstraint ^ ChildKeyConstraint { System::Data::ForeignKeyConstraint ^ get(); };
public virtual System.Data.ForeignKeyConstraint ChildKeyConstraint { get; }
member this.ChildKeyConstraint : System.Data.ForeignKeyConstraint
Public Overridable ReadOnly Property ChildKeyConstraint As ForeignKeyConstraint

Valore della proprietà

Oggetto ForeignKeyConstraint.A ForeignKeyConstraint.

Esempi

Nell'esempio seguente vengono impostate UpdateRulele DeleteRuleregole, AcceptReject e per l' ForeignKeyConstraint oggetto associato a DataRelation.The following example sets the UpdateRule, DeleteRule, and AcceptReject rule for the ForeignKeyConstraint associated with the DataRelation.

Private Sub SetChildKeyConstraint(dataSet As DataSet)
   ' Set child and parent columns.
   Dim parentColumn As DataColumn = dataSet.Tables( _
       "Suppliers").Columns("SupplierID")
   Dim childColumn As DataColumn = dataSet.Tables( _
       "Products").Columns("SupplierID")
   Dim relation As New DataRelation( _
       "SuppliersConstraint", parentColumn, childColumn)
   dataSet.Relations.Add(relation)

   Dim foreignKey As ForeignKeyConstraint = _
       relation.ChildKeyConstraint
   foreignKey.DeleteRule = Rule.SetNull
   foreignKey.UpdateRule = Rule.Cascade
   foreignKey.AcceptRejectRule = AcceptRejectRule.Cascade
End Sub

Commenti

Se per questa ForeignKeyConstraint relazione non esiste alcun oggetto associato, verrà creato automaticamente e a ChildKeyConstraintcui fa riferimento, quando la relazione viene aggiunta alla raccolta di relazioni.If no associated ForeignKeyConstraint exists for this relationship, it will be created automatically, and pointed to by the ChildKeyConstraint, when the relation is added to the collection of relations.

Si applica a

Vedi anche