DataRow.SetParentRow 方法

定义

设置 DataRow 的父行。

重载

SetParentRow(DataRow)

使用指定的新父 DataRow 设置 DataRow 的父行。

SetParentRow(DataRow, DataRelation)

使用指定的新父 DataRowDataRelation 设置 DataRow 的父行。

SetParentRow(DataRow)

使用指定的新父 DataRow 设置 DataRow 的父行。

public:
 void SetParentRow(System::Data::DataRow ^ parentRow);
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)

参数

parentRow
DataRow

新的父 DataRow

适用于

SetParentRow(DataRow, DataRelation)

使用指定的新父 DataRowDataRelation 设置 DataRow 的父行。

public:
 void SetParentRow(System::Data::DataRow ^ parentRow, System::Data::DataRelation ^ relation);
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)

参数

parentRow
DataRow

新的父 DataRow

relation
DataRelation

要使用的关系 DataRelation

例外

其中一行不属于表

其中一行为 null

该关系不属于 DataSet 对象的 DataRelationCollection

该关系的子级 DataTable 不是此行所属的表。

示例

以下示例设置特定子行的父行。

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

适用于