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!

DataSet.GetChildRelations

Gets the collection of child relations which belong to a specified table.

[Visual Basic]
Public Function GetChildRelations( _
   ByVal table As DataTable _
) As RelationsCollection
[C#]
public RelationsCollection GetChildRelations(
   DataTable table
);
[C++]
public: RelationsCollection* GetChildRelations(
   DataTable* table
);
[JScript]
public function GetChildRelations(
   table : DataTable
) : RelationsCollection;

Parameters

table
The DataTable whose child RelationsCollection is returned.

Return Value

The child RelationsCollection that belongs to the DataTable.

Example [Visual Basic]

In the following example, for each DataTable in the specified DataSet, the GetChildRelations method returns all child DataRelation objects. Each DataRelation is then used as an argument to the DataRow class's GetChildRows method to return any child DataRow objects. The value of each column in the array is then printed.

[Visual Basic]

Private Sub GetChildRowsFromDataRelation(myDataSet As DataSet)
   Dim t As DataTable
   Dim rels As RelationsCollection
   Dim dr As DataRelation
   Dim arrRows() As DataRow
   Dim r As DataRow
   Dim i As Integer
   Dim dc As DataColumn 

   For Each t in myDataSet.Tables
      rels = myDataSet.GetChildRelations(t)
         For Each dr In rels
For Each r In t.Rows
   arrRows = r.GetChildRows(dr)
   ' Print out the value of each column in the row.
   For i = 0 To UBound(arrRows)
      For Each dc In t.Columns
         Console.WriteLine(arrRows(i)(c))
      Next dc
   Next i
Next r
         Next dr
   Next t
End Sub

See Also

DataSet Class | DataSet Members | System.Data Namespace | DataRelation | Relations