Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DataRow::SetParentRow Method (DataRow^, DataRelation^)

 

Sets the parent row of a DataRow with specified new parent DataRow and DataRelation.

Namespace:   System.Data
Assembly:  System.Data (in System.Data.dll)

public:
void SetParentRow(
	DataRow^ parentRow,
	DataRelation^ relation
)

Parameters

parentRow
Type: System.Data::DataRow^

The new parent DataRow.

relation
Type: System.Data::DataRelation^

The relation DataRelation to use.

Exception Condition
RowNotInTableException

One of the rows does not belong to a table

ArgumentNullException

One of the rows is null.

ArgumentException

The relation does not belong to the DataRelationCollection of the DataSet object.

InvalidConstraintException

The relation's child DataTable is not the table this row belongs to.

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

Private Sub SetParent()
    ' Get a ParentRow and a ChildRow from a DataSet.
    Dim childRow As DataRow = _
        DataSet1.Tables("Orders").Rows(1)
    Dim parentRow As DataRow = _
        DataSet1.Tables("Customers").Rows(20)

    ' Set the parent row of a DataRelation.
    childRow.SetParentRow(parentRow, _
        DataSet1.Relations("CustomerOrders"))
End Sub

.NET Framework
Available since 1.1
Return to top
Show:
© 2017 Microsoft