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!

DataRelation.SetParentRow

Sets the parent row for the child row across this relation.

[Visual Basic]
Public Sub SetParentRow( _
   ByVal childRow As DataRow, _
   ByVal parentRow As DataRow _
)
[C#]
public void SetParentRow(
   DataRow childRow,
   DataRow parentRow
);
[C++]
public: void SetParentRow(
   DataRow* childRow,
   DataRow* parentRow
);
[JScript]
public function SetParentRow(
   childRow : DataRow,
   parentRow : DataRow
);

Parameters

childRow
The child DataRow to use.
parentRow
The new parent DataRow.

Exceptions

Exception Type Condition
RowNotInTableException One of the rows doesn't belong to a table
ArgumentNullException One of the rows is a null reference (in Visual Basic Nothing).
ArgumentException The relation doesn't belong to the DataSet object's RelationsCollection.
InvalidConstraintException The relation's child DataTable isn't the table this row belongs to.

Remarks

[Need explanation of why we do this.]

Example [Visual Basic]

The following example sets the parent row of a given child row.

[Visual Basic]

Private Sub SetParent()
   Dim childRow As DataRow
   Dim parentRow As DataRow
   ' Get a ParentRow and a ChildRow from a DataSet.
   childRow = DataSet1.Tables("Orders").Rows(1)
   parentRow = DataSet1.Tables("Customers").Rows(20)
   ' Set the parent row of a DataRelation.
   DataSet1.Relations("CustomerOrders").SetParentRow(childRow, parentRow)
End Sub

See Also

DataRelation Class | DataRelation Members | System.Data Namespace