语言

DataRow.SetParentRow 方法

定义

设置一个 DataRow的父行。

重载

名称 说明
SetParentRow(DataRow)

设置具有指定新父DataRow级的DataRow父行。

SetParentRow(DataRow, DataRelation)

设置具有指定新父DataRow级的父行DataRow和 DataRelation。

SetParentRow(DataRow)

Source:
DataRow.cs
Source:
DataRow.cs
Source:
DataRow.cs
Source:
DataRow.cs
Source:
DataRow.cs

设置具有指定新父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)

Source:
DataRow.cs
Source:
DataRow.cs
Source:
DataRow.cs
Source:
DataRow.cs
Source:
DataRow.cs

设置具有指定新父DataRow级的父行DataRow和 DataRelation。

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。

该关系不属于 DataRelationCollection 该 DataSet 对象的对象。

关系子 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

适用于