aspxtreme

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



Books and more ...


Suggested Reading

Need a break ?



Previous page Back to top Next page

Check out related books at Amazon

© 2000-2008 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 aspxtreme