asp.net.ph

DataRelation.ChildKeyConstraint Property

System.Data Namespace   DataRelation Class


Returns the ForeignKeyConstraint for the relation.

Syntax


Script [ ForeignKeyConstraint variable = ] DataRelation.ChildKeyConstraint

Property Value


variable A ForeignKeyConstraint

The property is read only with no default value.

Example

The following example sets the UpdateRule, DeleteRule, and AcceptReject rule for the ForeignKeyConstraint associated with the DataRelation.

private void SetChildKeyConstraint ( DataSet ds ) {
   DataColumn cCol, pCol;
   // set child and parent columns.
   pCol = ds.Tables [ "Suppliers" ].Columns [ "SupplierID" ];
   cCol = ds.Tables [ "Products" ].Columns [ "SupplierID" ];
   DataRelation dr = new DataRelation ( "SuppliersConstraint", pCol, cCol )

   ForeignKeyConstraint fk = dr.ChildKeyConstraint;
   fk.DeleteRule = Rule.SetNull;
   fk.UpdateRule = Rule.Cascade;
   fk.AcceptRejectRule = AcceptRejectRule.Cascade;
}
  C# VB

See Also

DataRelation Members   AcceptRejectRule   ParentKeyConstraint   Rule Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph