DataRow.GetChildRowsとは? わかりやすく解説

DataRow.GetChildRows メソッド (String, DataRowVersion)

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

名前空間: System.Data
アセンブリ: System.Data (system.data.dll 内)
構文構文

Public Function GetChildRows ( _
    relationName As String, _
    version As DataRowVersion _
) As DataRow()
Dim instance As DataRow
Dim relationName As String
Dim version As DataRowVersion
Dim returnValue As DataRow()

returnValue = instance.GetChildRows(relationName, version)
public DataRow[] GetChildRows (
    string relationName,
    DataRowVersion version
)
public:
array<DataRow^>^ GetChildRows (
    String^ relationName, 
    DataRowVersion version
)
public DataRow[] GetChildRows (
    String relationName, 
    DataRowVersion version
)
public function GetChildRows (
    relationName : String, 
    version : DataRowVersion
) : DataRow[]

パラメータ

relationName

使用する DataRelation の RelationName。

version

取得するデータのバージョンを指定する DataRowVersion 値の 1 つ。可能な値は、Default、Original、Current、および Proposed です。

戻り値
DataRow オブジェクトの配列、または長さ 0 の配列。

例外例外
例外の種類条件

ArgumentException

リレーションシップと行が同じテーブルに属していません。

ArgumentNullException

relation が null 参照 (Visual Basic では Nothing) です。

RowNotInTableException

行がこのテーブルに属していません。

VersionNotFoundException

要求された DataRowVersion が行にありません。

解説解説

DataTable は、ChildRelations プロパティが返す DataRelation オブジェクトのコレクションも格納します。

HasVersion プロパティを使用して、目的の DataRowVersion が存在するかどうかを確認します。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

DataRow.GetChildRows メソッド (String)

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

名前空間: System.Data
アセンブリ: System.Data (system.data.dll 内)
構文構文

Public Function GetChildRows ( _
    relationName As String _
) As DataRow()
Dim instance As DataRow
Dim relationName As String
Dim returnValue As DataRow()

returnValue = instance.GetChildRows(relationName)
public DataRow[] GetChildRows (
    string relationName
)
public:
array<DataRow^>^ GetChildRows (
    String^ relationName
)
public DataRow[] GetChildRows (
    String relationName
)
public function GetChildRows (
    relationName : String
) : DataRow[]

パラメータ

relationName

使用する DataRelation の RelationName。

戻り値
DataRow オブジェクトの配列、または長さ 0 の配列。

例外例外
例外の種類条件

ArgumentException

リレーションシップと行が同じテーブルに属していません。

RowNotInTableException

行がこのテーブルに属していません。

解説解説

DataTable は、ChildRelations プロパティが返す DataRelation オブジェクトのコレクションも格納します。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

DataRow.GetChildRows メソッド (DataRelation)

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

名前空間: System.Data
アセンブリ: System.Data (system.data.dll 内)
構文構文

Public Function GetChildRows ( _
    relation As DataRelation _
) As DataRow()
Dim instance As DataRow
Dim relation As DataRelation
Dim returnValue As DataRow()

returnValue = instance.GetChildRows(relation)
public DataRow[] GetChildRows (
    DataRelation relation
)
public:
array<DataRow^>^ GetChildRows (
    DataRelation^ relation
)
public DataRow[] GetChildRows (
    DataRelation relation
)
public function GetChildRows (
    relation : DataRelation
) : DataRow[]

パラメータ

relation

使用する DataRelation。

戻り値
DataRow オブジェクトの配列、または長さ 0 の配列。

例外例外
例外の種類条件

ArgumentException

リレーションシップと行が同じテーブルに属していません。

ArgumentNullException

リレーションシップが null 参照 (Visual Basic では Nothing) です。

RowNotInTableException

行がこのテーブルに属していません。

VersionNotFoundException

このバージョンのデータが行にありません。

解説解説

DataTable は、ChildRelations プロパティが返す DataRelation オブジェクトのコレクションも格納します。

使用例使用例

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

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.ChildRelations
      For Each row In table.Rows
          arrRows = row.GetChildRows(relation)
          ' Print values of rows.
          For i = 0 To arrRows.GetUpperBound(0)
             For Each column in
 table.Columns
                Console.WriteLine(arrRows(i)(column))
             Next column
          Next i
       Next row
    Next relation
 End Sub
private void GetChildRowsFromDataRelation(DataTable
 table) 
{
    DataRow[] arrRows;  
    foreach(DataRelation relation in table.ChildRelations)
    {
        foreach(DataRow row in table.Rows)
        {
            arrRows = row.GetChildRows(relation);
            // Print values of rows.
            for(int i = 0; i < arrRows.Length;
 i++)
            {
                foreach(DataColumn column in
 table.Columns)
                {
                    Console.WriteLine(arrRows[i][column]);
                }
            }
        }
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataRow クラス
DataRow メンバ
System.Data 名前空間
ChildRelations
DataRelation クラス
GetParentRows
Relations

DataRow.GetChildRows メソッド (DataRelation, DataRowVersion)

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

名前空間: System.Data
アセンブリ: System.Data (system.data.dll 内)
構文構文

Public Function GetChildRows ( _
    relation As DataRelation, _
    version As DataRowVersion _
) As DataRow()
Dim instance As DataRow
Dim relation As DataRelation
Dim version As DataRowVersion
Dim returnValue As DataRow()

returnValue = instance.GetChildRows(relation, version)
public DataRow[] GetChildRows (
    DataRelation relation,
    DataRowVersion version
)
public:
array<DataRow^>^ GetChildRows (
    DataRelation^ relation, 
    DataRowVersion version
)
public DataRow[] GetChildRows (
    DataRelation relation, 
    DataRowVersion version
)
public function GetChildRows (
    relation : DataRelation, 
    version : DataRowVersion
) : DataRow[]

パラメータ

relation

使用する DataRelation。

version

取得するデータのバージョンを指定する DataRowVersion 値の 1 つ。可能な値は、Default、Original、Current、および Proposed です。

戻り値
DataRow オブジェクトの配列。

例外例外
例外の種類条件

ArgumentException

リレーションシップと行が同じテーブルに属していません。

ArgumentNullException

relation が null 参照 (Visual Basic では Nothing) です。

RowNotInTableException

行がこのテーブルに属していません。

VersionNotFoundException

要求された DataRowVersion が行にありません。

解説解説

DataTable は、ChildRelations プロパティが返す DataRelation オブジェクトのコレクションも格納します。

HasVersion プロパティを使用して、目的の DataRowVersion が存在するかどうかを確認します。

使用例使用例

GetChildRows を使用して、DataTable 内の各子 DataRelation の子 DataRow オブジェクトを返す例を次に示します。行内の指定したバージョンの各列の値が出力されます。

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.ChildRelations
      For Each row In table.Rows
          arrRows = row.GetChildRows(relation, _
                DataRowVersion.Proposed)
          ' Print values of rows.
          For i = 0 To arrRows.GetUpperBound(0)
             For Each column in
 table.Columns
                Console.WriteLine(arrRows(i)(column))
             Next column
          Next i
       Next row
    Next relation
End Sub
private void GetChildRowsFromDataRelation(DataTable
 table ) 
{
    DataRow[] arrRows;  
    foreach(DataRelation relation in table.ChildRelations)
    {
        foreach(DataRow row in table.Rows)
        {
            arrRows = row.GetChildRows(relation, 
                DataRowVersion.Proposed);
            // Print values of rows.
            for(int i = 0; i < arrRows.Length;
 i++)
            {
                foreach(DataColumn column in
 table.Columns)
                {
                    Console.WriteLine(arrRows[i][column]);
                }
            }
        }
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataRow クラス
DataRow メンバ
System.Data 名前空間
ChildRelations
DataRelation クラス
DataRowVersion
GetParentRow
GetParentRows
Relations

DataRow.GetChildRows メソッド

DataRow の子行を取得します。
オーバーロードの一覧オーバーロードの一覧

名前 説明
DataRow.GetChildRows (DataRelation) 指定した DataRelation を使用して、この DataRow の子行を取得します。

.NET Compact Framework によってサポートされています。

DataRow.GetChildRows (String) DataRelation の指定した RelationName を使用して、DataRow の子行を取得します。

.NET Compact Framework によってサポートされています。

DataRow.GetChildRows (DataRelation, DataRowVersion) 指定した DataRelation と DataRowVersion を使用して、DataRow の子行を取得します。

.NET Compact Framework によってサポートされています。

DataRow.GetChildRows (String, DataRowVersion) DataRelation の指定した RelationName と DataRowVersion を使用して、DataRow の子行を取得します。

.NET Compact Framework によってサポートされています。

参照参照

関連項目

DataRow クラス
DataRow メンバ
System.Data 名前空間
ChildRelations
DataRelation クラス
GetParentRows
Relations



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「DataRow.GetChildRows」の関連用語

DataRow.GetChildRowsのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DataRow.GetChildRowsのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS