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

Definición

Obtiene el ForeignKeyConstraint para la relación.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

Valor de propiedad

Objeto ForeignKeyConstraint.A ForeignKeyConstraint.

Ejemplos

En el ejemplo siguiente se UpdateRuleestablece DeleteRulela regla AcceptReject , y para ForeignKeyConstraint el asociado 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

Comentarios

Si no existe ForeignKeyConstraint ningún asociado para esta relación, se creará automáticamente y señalará ChildKeyConstraintcuando se agregue la relación a la colección de relaciones.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.

Se aplica a

Consulte también: