DataRow.SetParentRow Method

Definition

Sets the parent row of a DataRow.

Overloads

SetParentRow(DataRow)

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

SetParentRow(DataRow, DataRelation)

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

SetParentRow(DataRow)

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

public:
 void SetParentRow(System::Data::DataRow ^ parentRow);
public void SetParentRow (System.Data.DataRow parentRow);
member this.SetParentRow : System.Data.DataRow -> unit
Public Sub SetParentRow (parentRow As DataRow)

Parameters

parentRow
DataRow

The new parent DataRow.

SetParentRow(DataRow, DataRelation)

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

public:
 void SetParentRow(System::Data::DataRow ^ parentRow, System::Data::DataRelation ^ relation);
public void SetParentRow (System.Data.DataRow parentRow, System.Data.DataRelation relation);
member this.SetParentRow : System.Data.DataRow * System.Data.DataRelation -> unit
Public Sub SetParentRow (parentRow As DataRow, relation As DataRelation)

Parameters

parentRow
DataRow

The new parent DataRow.

relation
DataRelation

The relation DataRelation to use.

Exceptions

One of the rows does not belong to a table

One of the rows is null.

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

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

Examples

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

Applies to