Export (0) Print
Expand All

DataRelation.ParentKeyConstraint Property

Gets the UniqueConstraint that ensures values in the parent column of a DataRelation are unique.

[Visual Basic]
Public Overridable ReadOnly Property ParentKeyConstraint As _
   UniqueConstraint
[C#]
public virtual UniqueConstraint ParentKeyConstraint {get;}
[C++]
public: __property virtual UniqueConstraint*
   get_ParentKeyConstraint();
[JScript]
public function get ParentKeyConstraint() : UniqueConstraint;

Property Value

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

Example

[Visual Basic] The following example gets the ParentKeyConstraint of a DataRelation object.

[Visual Basic] 
Private Sub GetParentKeyConstraint()
    Dim pkCstrt As UniqueConstraint
    ' Get a DataRelation from a DataSet.
    Dim rel As DataRelation
    rel = DataSet1.Relations("CustomerOrders")
    ' Get the relations parent key constraint.
    pkCstrt = rel.ParentKeyConstraint
    ' Get the constraint's DataColumns
    Dim cstrtCols() As DataColumn
    cstrtCols = pkCstrt.Columns
    ' Print the column names.
    Dim i As Integer
    For i = 0 to cstrtCols.GetUpperBound(0)
       Debug.Write(cstrtCols(i).ColumnName)
    Next i
 End Sub

[C#, C++, JScript] No example is available for C#, C++, or JScript. To view a Visual Basic example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

DataRelation Class | DataRelation Members | System.Data Namespace | ChildKeyConstraint | UniqueConstraint

Show:
© 2014 Microsoft