DataRow.SetParentRow 方法

定義

設定 DataRow 的父資料列。

多載

SetParentRow(DataRow)

使用指定的新父 DataRow,設定 DataRow 的父資料列。

SetParentRow(DataRow, DataRelation)

使用指定的新父 DataRowDataRow,設定 DataRelation 的父資料列。

SetParentRow(DataRow)

來源:
DataRow.cs
來源:
DataRow.cs
來源:
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)

來源:
DataRow.cs
來源:
DataRow.cs
來源:
DataRow.cs

使用指定的新父 DataRowDataRow,設定 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

關聯的子 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

適用於