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!

DataRow.GetChildRows (DataRelation)

Gets the child rows of this DataRow using the specified DataRelation.

[Visual Basic]
Overloads Public Function GetChildRows( _
   ByVal relation As DataRelation _
) As DataRow ()
[C#]
public DataRow[] GetChildRows(
   DataRelation relation
);
[C++]
public: DataRow* GetChildRows(
   DataRelation* relation
) [];
[JScript]
public function GetChildRows(
   relation : DataRelation
) : DataRow[];

Parameters

relation
The DataRelation to use.

Return Value

An array of DataRow objects (or an array of length zero).

Exceptions

Exception Type Condition
RowNotInTableException The row doesn't belong to the table.
ArgumentNullException The relation is a null reference (in Visual Basic Nothing).
ArgumentException The relation and row don't belong to the same table.
VersionNotFoundException The row doesn't have this version of data.

Remarks

In a DataSet, the collection of all DataRelation objects for the data set is returned by the GetChildRelations method.

The DataTable also contains a collection of DataRelation objects, also returned by the ChildRelations property.

Example [Visual Basic]

The following example uses the GetChildRows to return the child DataRow objects for every child DataRelation in a DataTable. 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.ChildRelations
     For Each r In myTable.Rows
         arrRows = r.GetChildRows(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

See Also

DataRow Class | DataRow Members | System.Data Namespace | DataRow.GetChildRows Overload List | ChildRelations | DataRelation | GetParentRows | Relations