语言

DataRow.GetParentRows 方法

定义

获取一个 DataRow. 的父行。

重载

名称 说明
GetParentRows(DataRelation, DataRowVersion)

获取使用指定项的DataRow父行,以及 DataRelation。DataRowVersion

GetParentRows(DataRelation)

获取使用指定DataRow项的DataRelation父行。

GetParentRows(String)

获取使用指定DataRow项的RelationNameDataRelation父行。

GetParentRows(String, DataRowVersion)

获取使用指定DataRowRelationName项的DataRelation父行,以及 DataRowVersion。

GetParentRows(DataRelation, DataRowVersion)

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

获取使用指定项的DataRow父行,以及 DataRelation。DataRowVersion

public:
 cli::array <System::Data::DataRow ^> ^ GetParentRows(System::Data::DataRelation ^ relation, System::Data::DataRowVersion version);
public System.Data.DataRow[] GetParentRows(System.Data.DataRelation? relation, System.Data.DataRowVersion version);
public System.Data.DataRow[] GetParentRows(System.Data.DataRelation relation, System.Data.DataRowVersion version);
member this.GetParentRows : System.Data.DataRelation * System.Data.DataRowVersion -> System.Data.DataRow[]
Public Function GetParentRows (relation As DataRelation, version As DataRowVersion) As DataRow()

参数

relation
DataRelation

要使用的 DataRelation 。

version
DataRowVersion

DataRowVersion指定要获取的数据版本的值之一。

返回

对象的数组 DataRow 或长度为零的数组。

例外

该DataRelation行不属于此行。DataSet

行为 null.

关系子表不是行所属的表。

示例

以下示例使用 > 返回每个子项的子对象。 然后打印行中每列的值。

Private Sub GetChildRowsFromDataRelation(table As DataTable, ver As DataRowVersion)
    Dim relation As DataRelation
    Dim arrRows() As DataRow
    Dim row As DataRow
    Dim i As Integer
    Dim column As DataColumn 
 
    For Each relation In table.ParentRelations
      For Each row In table.Rows
          arrRows = row.GetParentRows(relation, ver)
          ' Print values of rows.
          For i = 0 To arrRows.GetUpperBound(0)
             For Each column in table.Columns
                Console.WriteLine(arrRows(i)(column.ColumnName))
             Next column
          Next i
       Next row
    Next relation
End Sub

注解

在一个集合 DataSet中,数据集的所有父 DataRelation 对象的集合由 GetParentRows 该方法返回。

它还DataTable包含属性返回DataRelation的对象ParentRelations集合。

使用属性 HasVersion 确定 DataRowVersion 所需的是否存在。

另请参阅

适用于

GetParentRows(DataRelation)

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

获取使用指定DataRow项的DataRelation父行。

public:
 cli::array <System::Data::DataRow ^> ^ GetParentRows(System::Data::DataRelation ^ relation);
public System.Data.DataRow[] GetParentRows(System.Data.DataRelation? relation);
public System.Data.DataRow[] GetParentRows(System.Data.DataRelation relation);
member this.GetParentRows : System.Data.DataRelation -> System.Data.DataRow[]
Public Function GetParentRows (relation As DataRelation) As DataRow()

参数

relation
DataRelation

要使用的 DataRelation 。

返回

对象的数组 DataRow 或长度为零的数组。

例外

该DataRelation行不属于此行。DataSet

行为 null.

关系子表不是行所属的表。

示例

以下示例使用 > 返回每个子项的子对象。 然后打印行中每列的值。

Private Sub GetChildRowsFromDataRelation(table As DataTable)
    Dim relation As DataRelation
    Dim arrRows() As DataRow
    Dim row As DataRow
    Dim i As Integer
    Dim column As DataColumn 
 
    For Each relation In table.ParentRelations
      For Each row In table.Rows
          arrRows = row.GetParentRows(relation)
          ' Print values of rows.
          For i = 0 To arrRows.GetUpperBound(0)
             For Each column in table.Columns
                Console.WriteLine(arrRows(i)(column.ColumnName))
             Next column
          Next i
       Next row
    Next relation
 End Sub

注解

在一个集合 DataSet中,数据集的所有父 DataRelation 对象的集合由 GetParentRows 该方法返回。

它还DataTable包含属性返回DataRelation的对象ParentRelations集合。

另请参阅

适用于

GetParentRows(String)

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

获取使用指定DataRow项的RelationNameDataRelation父行。

public:
 cli::array <System::Data::DataRow ^> ^ GetParentRows(System::String ^ relationName);
public System.Data.DataRow[] GetParentRows(string? relationName);
public System.Data.DataRow[] GetParentRows(string relationName);
member this.GetParentRows : string -> System.Data.DataRow[]
Public Function GetParentRows (relationName As String) As DataRow()

参数

relationName
String

的 RelationNameDataRelation.

返回

对象的数组 DataRow 或长度为零的数组。

例外

关系和行不属于同一个表。

该行不属于该表。

注解

在一个集合 DataSet中,数据集的所有父 DataRelation 对象的集合由 GetParentRows 该方法返回。

它还DataTable包含属性返回DataRelation的对象ParentRelations集合。

适用于

GetParentRows(String, DataRowVersion)

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

获取使用指定DataRowRelationName项的DataRelation父行,以及 DataRowVersion。

public:
 cli::array <System::Data::DataRow ^> ^ GetParentRows(System::String ^ relationName, System::Data::DataRowVersion version);
public System.Data.DataRow[] GetParentRows(string? relationName, System.Data.DataRowVersion version);
public System.Data.DataRow[] GetParentRows(string relationName, System.Data.DataRowVersion version);
member this.GetParentRows : string * System.Data.DataRowVersion -> System.Data.DataRow[]
Public Function GetParentRows (relationName As String, version As DataRowVersion) As DataRow()

参数

relationName
String

的 RelationNameDataRelation.

version
DataRowVersion

DataRowVersion指定要获取的数据版本的值之一。 可能值为 Default、Original、Current 和 Proposed。

返回

对象的数组 DataRow 或长度为零的数组。

例外

关系和行不属于同一个表。

该行不属于该表。

注解

在一个集合 DataSet中,数据集的所有父 DataRelation 对象的集合由 GetParentRows 该方法返回。

它还DataTable包含属性返回DataRelation的对象ParentRelations集合。

使用属性 HasVersion 确定 DataRowVersion 所需的是否存在。

适用于