Gets the collection of parent relations for this DataTable.
[Visual Basic] Public ReadOnly Property ParentRelations As RelationsCollection [C#] public RelationsCollection ParentRelations {get;} [C++] public: __property RelationsCollection* get_ParentRelations(); [JScript] public function get ParentRelations() : RelationsCollection;
A RelationsCollection that contains the parent relations for the table.
The following example uses the ParentRelations property to return each parent DataRelation in a DataTable. Each relation is then used as an argument in the GetParentRows method of the DataRow to return an array of rows. The value of each column in the row is then printed.
[Visual Basic]
Private Sub GetChildRowsFromDataRelation(myTable As DataTable) Dim dr As DataRelation Dim arrRows() As DataRow Dim r As DataRow Dim i As Integer Dim dc As DataColumn For Each dr In myTable.ParentRelations For Each r In myTable.Rows arrRows = r.GetParentRows(dr) ' Print values of rows. For i = 0 To UBound(arrRows) For Each dc in myTable.Columns Console.WriteLine(arrRows(i)(dc)) Next dc Next i Next r Next dr End Sub
DataTable Class | DataTable Members | System.Data Namespace | ChildRelations