次の方法で共有


DataRow.GetParentRows メソッド

DataRow の親行を取得します。

オーバーロードの一覧

指定した DataRelation を使用して、 DataRow の親行を取得します。

.NET Compact Framework でもサポート。

[Visual Basic] Overloads Public Function GetParentRows(DataRelation) As DataRow()

[C#] public DataRow[] GetParentRows(DataRelation);

[C++] public: DataRow* GetParentRows(DataRelation*) [];

[JScript] public function GetParentRows(DataRelation) : DataRow[];

DataRelation の指定した RelationName を使用して、 DataRow の親行を取得します。

.NET Compact Framework でもサポート。

[Visual Basic] Overloads Public Function GetParentRows(String) As DataRow()

[C#] public DataRow[] GetParentRows(string);

[C++] public: DataRow* GetParentRows(String*) [];

[JScript] public function GetParentRows(String) : DataRow[];

指定した DataRelationDataRowVersion を使用して、 DataRow の親行を取得します。

.NET Compact Framework でもサポート。

[Visual Basic] Overloads Public Function GetParentRows(DataRelation, DataRowVersion) As DataRow()

[C#] public DataRow[] GetParentRows(DataRelation, DataRowVersion);

[C++] public: DataRow* GetParentRows(DataRelation*, DataRowVersion) [];

[JScript] public function GetParentRows(DataRelation, DataRowVersion) : DataRow[];

DataRelation の指定した RelationNameDataRowVersion を使用して、 DataRow の親行を取得します。

.NET Compact Framework でもサポート。

[Visual Basic] Overloads Public Function GetParentRows(String, DataRowVersion) As DataRow()

[C#] public DataRow[] GetParentRows(string, DataRowVersion);

[C++] public: DataRow* GetParentRows(String*, DataRowVersion) [];

[JScript] public function GetParentRows(String, DataRowVersion) : DataRow[];

使用例

[Visual Basic] GetParentRows を使用して、 DataTable 内の各子 DataRelation の子 DataRow オブジェクトを返す例を次に示します。次に、行の各列の値が出力されます。

[Visual Basic] メモ   ここでは、GetParentRows のオーバーロード形式のうちの 1 つだけについて、使用例を示します。その他の例については、各オーバーロード形式のトピックを参照してください。

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

[C#, C++, JScript] C#、C++、および JScript のサンプルはありません。Visual Basic のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

参照

DataRow クラス | DataRow メンバ | System.Data 名前空間