DataRow.SetParentRow 方法    
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
设置 DataRow 的父行。
重载
| SetParentRow(DataRow) | |
| SetParentRow(DataRow, DataRelation) | 使用指定的新父 DataRow 和 DataRelation 设置 DataRow 的父行。 | 
SetParentRow(DataRow)
- Source:
- DataRow.cs
- Source:
- DataRow.cs
- Source:
- 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 -> unitPublic Sub SetParentRow (parentRow As DataRow)参数
适用于
SetParentRow(DataRow, DataRelation)
- Source:
- DataRow.cs
- Source:
- DataRow.cs
- Source:
- DataRow.cs
使用指定的新父 DataRow 和 DataRelation 设置 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 -> unitPublic Sub SetParentRow (parentRow As DataRow, relation As DataRelation)参数
- 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