DataRow.GetParentRow メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DataRow.GetParentRow メソッドの意味・解説 

DataRow.GetParentRow メソッド (String)

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

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

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

returnValue = instance.GetParentRow(relationName)
public DataRow GetParentRow (
    string relationName
)
public:
DataRow^ GetParentRow (
    String^ relationName
)
public DataRow GetParentRow (
    String relationName
)
public function GetParentRow (
    relationName : String
) : DataRow

パラメータ

relationName

DataRelation の RelationName。

戻り値
現在の行の親 DataRow

例外例外
例外種類条件

ArgumentException

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

RowNotInTableException

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

解説解説

DataSet で、データ セットすべてのDataRelation オブジェクトコレクションは、GetParentRows メソッドによって返されます。

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

使用例使用例

GetParentRow使用してDataTable 内のDataRow の各親行から値を出力する例を次に示します

Private Sub GetParentRowForTable( _
    thisTable As DataTable, relation As String)
     If thisTable Is Nothing
 Then
         Return
     End If

     ' For each row in the table, print column 1 
     ' of the parent DataRow.
     Dim parentRow As DataRow
     Dim row As DataRow
     For Each row In  thisTable.Rows
         parentRow = row.GetParentRow(relation)
         Console.Write(ControlChars.Tab + " child row: "
 _
            + row(1).ToString())
         Console.Write(ControlChars.Tab + " parent row: "
 _
            + parentRow(1).ToString() + ControlChars.Cr)
     Next row
End Sub    
    
Private Sub CallGetParentRowForTable()
     ' An example of calling the function.
     Dim thisTable As DataTable = DataSet1.Tables("Products")
     Dim relation As DataRelation = thisTable.ParentRelations(0)
     GetParentRowForTable(thisTable, relation.RelationName)
End Sub
private void GetParentRowForTable(
    DataTable thisTable, string relation)
{
    if(thisTable ==null){return;}
    // For each row in the table, print column 1 
    // of the parent DataRow.
    DataRow parentRow;
    foreach(DataRow row in thisTable.Rows)
    {
        parentRow = row.GetParentRow(relation);
        Console.Write("\table child row: " + row[1]);
        Console.Write("\table parent row: " + parentRow[1]+ "\n");
    }
}
 
private void CallGetParentRowForTable()
{
    // An example of calling the function.
    DataTable thisTable = DataSet1.Tables["Products"];
    DataRelation relation = thisTable.ParentRelations[0];
    GetParentRowForTable(thisTable, relation.RelationName);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

DataRow.GetParentRow メソッド (DataRelation)

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

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

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

returnValue = instance.GetParentRow(relation)
public DataRow GetParentRow (
    DataRelation relation
)
public:
DataRow^ GetParentRow (
    DataRelation^ relation
)
public DataRow GetParentRow (
    DataRelation relation
)
public function GetParentRow (
    relation : DataRelation
) : DataRow

パラメータ

relation

使用する DataRelation。

戻り値
現在の行の親 DataRow

例外例外
例外種類条件

ArgumentNullException

この relation は DataTable に属していません。

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

InvalidConstraintException

この行は DataRelation オブジェクトの子テーブル属していません。

RowNotInTableException

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

解説解説

DataSet で、データ セットすべてのDataRelation オブジェクトコレクションは、GetParentRows メソッドによって返されます。

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

使用例使用例

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

Private Sub GetParentRowForTable _
   (thisTable As DataTable, relation As DataRelation)
    If thisTable Is Nothing
 Then
        Return
    End If
    ' For each row in the table, print column 1 
    ' of the parent DataRow.
    Dim parentRow As DataRow
    Dim row As DataRow
    For Each row In  thisTable.Rows
        parentRow = row.GetParentRow(relation)
        Console.Write(ControlChars.Tab & " child row: "
 _
           & row(1).ToString())
        Console.Write(ControlChars.Tab & " parent row: "
 _
           & parentRow(1).ToString() & ControlChars.Cr)
    Next row
End Sub
  
Private Sub CallGetParentRowForTable()
    ' An example of calling the function.
    Dim thisTable As DataTable = DataSet1.Tables("Products")
    Dim relation As DataRelation = thisTable.ParentRelations(0)
    GetParentRowForTable(thisTable, relation)
End Sub
private void GetParentRowForTable(DataTable
 thisTable, 
    DataRelation relation)
{
    if(thisTable ==null){return;}
    // For each row in the table, print column 1 
    // of the parent DataRow.
    DataRow parentRow;
    foreach(DataRow row in thisTable.Rows)
    {
        parentRow = row.GetParentRow(relation);
        Console.Write("\table child row: " + row[1]);
        Console.Write("\table parent row: " + parentRow[1]+ "\n");
    }
}
 
private void CallGetParentRowForTable()
{
    // An example of calling the function.
    DataTable thisTable = DataSet1.Tables["Products"];
    DataRelation relation = thisTable.ParentRelations[0];
    GetParentRowForTable(thisTable, relation);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataRow クラス
DataRow メンバ
System.Data 名前空間
ChildRelations
DataRelation クラス
GetChildRows
GetParentRow
Relations

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

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

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

Public Function GetParentRow ( _
    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.GetParentRow(relationName, version)
public DataRow GetParentRow (
    string relationName,
    DataRowVersion version
)
public:
DataRow^ GetParentRow (
    String^ relationName, 
    DataRowVersion version
)
public DataRow GetParentRow (
    String relationName, 
    DataRowVersion version
)
public function GetParentRow (
    relationName : String, 
    version : DataRowVersion
) : DataRow

パラメータ

relationName

DataRelation の RelationName。

version

DataRowVersion 値の 1 つ

戻り値
現在の行の親 DataRow

例外例外
例外種類条件

ArgumentException

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

ArgumentNullException

relationnull 参照 (Visual Basic では Nothing) です。

RowNotInTableException

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

VersionNotFoundException

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

解説解説

DataSet で、データ セットすべてのDataRelation オブジェクトコレクションは、GetParentRows メソッドによって返されます。

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

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

使用例使用例

GetParentRow を使用してDataTable 内のDataRow の各親行から値を出力する例を次に示します

Private Sub GetParentRowForTable _
    (thisTable As DataTable, relation As String,
 _
    version As DataRowVersion)
     If thisTable Is Nothing
 Then
         Return
     End If
     ' For each row in the table, print column 1 
     ' of the parent DataRow.
     Dim parentRow As DataRow
     Dim row As DataRow
     For Each row In  thisTable.Rows
         parentRow = row.GetParentRow(relation, version)
         Console.Write(ControlChars.Tab & " child row: "
 _
            & row(1).ToString())
         Console.Write(ControlChars.Tab & " parent row: "
 _
            & parentRow(1).ToString() & ControlChars.Cr)
     Next row
End Sub
   
Private Sub CallGetParentRowForTable()
     ' An example of calling the function.
     Dim thisTable As DataTable = DataSet1.Tables("Products")
     Dim relation As DataRelation = thisTable.ParentRelations(0)
     ' Print only original versions of parent rows.
     GetParentRowForTable(thisTable, relation.RelationName, _
        DataRowVersion.Original)
End Sub
private void GetParentRowForTable(DataTable
 thisTable, 
    string relation, DataRowVersion version)
{
    if(thisTable ==null){return;}
    // For each row in the table, print column 1 
    // of the parent DataRow.
    DataRow parentRow;
    foreach(DataRow row in thisTable.Rows)
    {
        parentRow = row.GetParentRow(relation, version);
        Console.Write("\t child row: " + row[1]);
        Console.Write("\t parent row: " + parentRow[1]+ "\n");
    }
}
 
private void CallGetParentRowForTable()
{
    // An example of calling the function.
    DataTable thisTable = DataSet1.Tables["Products"];
    DataRelation relation = thisTable.ParentRelations[0];

    // Print only original versions of parent rows.
    GetParentRowForTable(thisTable, relation.RelationName,
        DataRowVersion.Original);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

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

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

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

Public Function GetParentRow ( _
    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.GetParentRow(relation, version)
public DataRow GetParentRow (
    DataRelation relation,
    DataRowVersion version
)
public:
DataRow^ GetParentRow (
    DataRelation^ relation, 
    DataRowVersion version
)
public DataRow GetParentRow (
    DataRelation relation, 
    DataRowVersion version
)
public function GetParentRow (
    relation : DataRelation, 
    version : DataRowVersion
) : DataRow

パラメータ

relation

使用する DataRelation。

version

取得するデータバージョン指定する DataRowVersion 値の 1 つ

戻り値
現在の行の親 DataRow

例外例外
例外種類条件

ArgumentNullException

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

relation は、このテーブルの親リレーションシップ属していません。

InvalidConstraintException

このリレーションシップの子テーブルは、この行が属しているテーブルではありません。

RowNotInTableException

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

VersionNotFoundException

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

解説解説

DataSet で、データ セットすべてのDataRelation オブジェクトコレクションは、GetParentRows メソッドによって返されます。

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

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

使用例使用例

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

Private Sub GetParentRowForTable _
    (thisTable As DataTable, relation As DataRelation,
 _
    version As DataRowVersion)
    If thisTable Is Nothing
 Then
        Return
    End If

    ' For each row in the table, print column 1 
    ' of the parent DataRow.
    Dim parentRow As DataRow
    Dim row As DataRow
    For Each row In  thisTable.Rows
        parentRow = row.GetParentRow(relation, version)
        Console.Write(ControlChars.Tab & " child row: "
 & _
            row(1).ToString())
        Console.Write(ControlChars.Tab & " parent row: "
 _
            & parentRow(1).ToString() & ControlChars.Cr)
    Next row
End Sub

Private Sub CallGetParentRowForTable()
    ' An example of calling the function.
    Dim thisTable As DataTable = DataSet1.Tables("Products")
    Dim relation As DataRelation = thisTable.ParentRelations(0)

    ' Print only original versions of parent rows.
    GetParentRowForTable(thisTable, relation, _
        DataRowVersion.Original)
End Sub
private void GetParentRowForTable(DataTable
 thisTable, 
    DataRelation relation,
    DataRowVersion version) 
{
    if(thisTable ==null){return;}
    // For each row in the table, print column 1 of the 
    // parent DataRow.
    DataRow parentRow;
    foreach(DataRow row in thisTable.Rows)
    {
        parentRow = row.GetParentRow(relation, version);
        Console.Write("\table child row: " + row[1]);
        Console.Write("\table parent row: " + parentRow[1]+ "\n");
    }
}
 
private void CallGetParentRowForTable() 
{
    // An example of calling the function.
    DataTable thisTable = DataSet1.Tables["Products"];
    DataRelation relation = thisTable.ParentRelations[0];
    // Print only original versions of parent rows.
    GetParentRowForTable(thisTable, relation,
        DataRowVersion.Original);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataRow クラス
DataRow メンバ
System.Data 名前空間
ChildRelations
DataRelation クラス
DataRowVersion
GetChildRows
GetParentRow
Relations

DataRow.GetParentRow メソッド

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

名前 説明
DataRow.GetParentRow (DataRelation) 指定した DataRelation を使用してDataRow の親行を取得します

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

DataRow.GetParentRow (String) DataRelation指定した RelationName を使用してDataRow の親行を取得します

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

DataRow.GetParentRow (DataRelation, DataRowVersion) 指定した DataRelation と DataRowVersion を使用してDataRow の親行を取得します

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

DataRow.GetParentRow (String, DataRowVersion) DataRelation指定した RelationNameDataRowVersion使用してDataRow の親行を取得します

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

参照参照

関連項目

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



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「DataRow.GetParentRow メソッド」の関連用語

DataRow.GetParentRow メソッドのお隣キーワード
検索ランキング

   

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



DataRow.GetParentRow メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS