DataRow.SetParentRow Method

Definition

设置 DataRow 的父行。Sets the parent row of a DataRow.

Overloads

SetParentRow(DataRow)

使用指定的新父 DataRow 设置 DataRow 的父行。Sets the parent row of a DataRow with specified new parent DataRow.

SetParentRow(DataRow, DataRelation)

使用指定的新父 DataRowDataRelation 设置 DataRow 的父行。Sets the parent row of a DataRow with specified new parent DataRow and DataRelation.

SetParentRow(DataRow)

使用指定的新父 DataRow 设置 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

新的父 DataRowThe new parent DataRow.

SetParentRow(DataRow, DataRelation)

使用指定的新父 DataRowDataRelation 设置 DataRow 的父行。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

新的父 DataRowThe new parent DataRow.

relation
DataRelation

要使用的关系 DataRelationThe relation DataRelation to use.

Exceptions

其中一行不属于表One of the rows does not belong to a table

其中一行为 nullOne of the rows is null.

该关系不属于 DataSet 对象的 DataRelationCollectionThe relation does not belong to the DataRelationCollection of the DataSet object.

该关系的子级 DataTable 不是此行所属的表。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