asp.net.ph

DataRelation.ParentKeyConstraint Property

System.Data Namespace   DataRelation Class


Returns the UniqueConstraint for the relation.

Syntax


Script [ UniqueConstraint variable = ] DataRelation.ParentKeyConstraint

Property Value


variable A UniqueConstraint that ensures values in a parent column are unique.

The property is read only with no default value.

Remarks

This property is used to return the UniqueConstraint that ensures values in the parent column of a DataRelation are unique.

Example

The following example gets the ParentKeyConstraint associated with the DataRelation.

private void GetParentKeyConstraint ( ) {
   // get a DataRelation from a DataSet.
   DataRelation dr = myDataSet.Relations [ "CustomerOrders" ];
   // get the relation's parent key constraint.
   UniqueConstraint pkCstrt = dr.ParentKeyConstraint;
   // get the constraint's DataColumns
   DataColumn [ ] cstrtCols = pkCstrt.Columns;
   // print the column names.
   int i;
   for ( i = 0; i < cstrtCols.Length; i++ ) {
      Response.Write ( cstrtCols [ ].ColumnName );
   }
}
  C# VB

See Also

DataRelation Members   AcceptRejectRule   ChildKeyConstraint   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