This documentation is archived and is not being maintained.

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 _
public virtual UniqueConstraint ParentKeyConstraint {get;}
public: __property virtual UniqueConstraint*
public function get ParentKeyConstraint() : UniqueConstraint;

Property Value

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


[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)
    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.


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