DataTable.ParentRelations プロパティ
アセンブリ: System.Data (system.data.dll 内)

テーブルの親リレーションを格納している DataRelationCollection。DataRelation オブジェクトが存在しない場合、空のコレクションが返されます。

ParentRelations プロパティを使用して、DataTable 内の各親 DataRelation を返す例を次に示します。次に、DataRow の GetParentRows メソッドで各リレーションシップを引数として使用して、行の配列を返します。次に、行の各列の値が出力されます。
Private Sub GetChildRowsFromDataRelation(table As DataTable) Dim rowArray() As DataRow Dim relation As DataRelation, row As DataRow Dim column As DataColumn, i As Integer For Each relation In table.ParentRelations For Each row In table.Rows rowArray = row.GetParentRows(relation) ' Print values of rows. For i = 0 To rowArray.Length - 1 For Each column In table.Columns Console.WriteLine(rowArray(i)(column)) Next column Next i Next row Next relation End Sub
private void GetChildRowsFromDataRelation(DataTable table) { DataRow[] rowArray; foreach(DataRelation relation in table.ParentRelations) { foreach(DataRow row in table.Rows) { rowArray = row.GetParentRows(relation); // Print values of rows. for(int i = 0; i < rowArray.Length; i++) { foreach(DataColumn column in table.Columns) { Console.WriteLine(rowArray[i][column]); } } } } }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からDataTable.ParentRelations プロパティを検索する場合は、下記のリンクをクリックしてください。

- DataTable.ParentRelations プロパティのページへのリンク