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;
A DataRelation, if one is found.
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
DataColumn Class | DataColumn Members | System.Data Namespace | ChildRelations | DataRelation | ParentRelations | RelationsCollection