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.GetParentRow (DataRelation, DataRowVersion)

Gets the parent row of this DataRow using the specified DataRelation and DataRowVersion.

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

Parameters

relation
The DataRelation to use.
version
One of the DataRowVersion values specifying the version of the data to get.

Exceptions

Exception Type Condition
RowNotInTableException The row doesn't belong to a table.
ArgumentNullException The row is a null reference (in Visual Basic Nothing).

The relation doesn't belong to this table's parent relations.

VersionNotFoundException The row doesn't have this version of data.
InvalidConstraintException The relations's child table isn't the table the row belongs to.

Example [Visual Basic]

The following example uses the GetParentRow 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, ver As DataRowVersion)
   Dim dr As DataRelation
   Dim myRow 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
         myRow = r.GetParentRow(dr, ver)
         ' Print values of the row.
         For Each dc in myTable.Columns
Console.WriteLine(myRow(dc))
         Next dc
      Next r
   Next dr
End Sub

See Also

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