NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DataColumn.FindParentRelation

Finds a relation that this column is the sole child of or null.

[Visual Basic]
Public Function FindParentRelation() As DataRelation
[C#]
public DataRelation FindParentRelation();
[C++]
public: DataRelation* FindParentRelation();
[JScript]
public function FindParentRelation() : DataRelation;

Return Value

A DataRelation, if one is found.

Example [Visual Basic]

The following example uses the FindParentRelation method to return a DataRelation, the relation's name, and the name of the relation's parent column.

[Visual Basic]

Private Sub GetParent()
   Dim parentRel As DataRelation
   ' Get a column from a DataSet
   Dim myCol As DataColumn
   Dim parentCols() As DataColumn
   myCol = DataSet1.Tables("OrderDetails").Columns("OrderID")
   parentRel = myCol.FindParentRelation
   Console.WriteLine(parentRel.RelationName)
   ' Get the ParentColumn of the relation
   parentCols = parentRel.ParentColumns
   Dim i As Integer
   For i = 0 to UBound(parentCols)
      Console.WriteLine(parentCols(i).ColumnName, parentCols(i).ToString)
   Next i
End Sub

See Also

DataColumn Class | DataColumn Members | System.Data Namespace | ChildRelations | DataRelation | ParentRelations | RelationsCollection