DataRow.SetParentRow 方法
本文內容
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
設定 DataRow 的父資料列。
| SetParentRow(DataRow) | |
| SetParentRow(DataRow, DataRelation) |
使用指定的新父 DataRow 和 DataRow,設定 DataRelation 的父資料列。 |
- 來源:
- DataRow.cs
- 來源:
- DataRow.cs
- 來源:
- DataRow.cs
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)
參數
適用於
.NET 9 及其他版本
| 產品 | 版本 |
|---|---|
| .NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
| .NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
| .NET Standard | 2.0, 2.1 |
- 來源:
- DataRow.cs
- 來源:
- DataRow.cs
- 來源:
- 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)
參數
- 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
適用於
.NET 9 及其他版本
| 產品 | 版本 |
|---|---|
| .NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
| .NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
| .NET Standard | 2.0, 2.1 |