DataRow.GetChildRows 메서드

정의

DataRow의 자식 행을 가져옵니다.

오버로드

GetChildRows(DataRelation)

지정된 DataRow을 사용하여 이 DataRelation의 자식 행을 가져옵니다.

GetChildRows(String)

DataRow의 지정된 RelationName을 사용하여 DataRelation의 자식 행을 가져옵니다.

GetChildRows(DataRelation, DataRowVersion)

지정된 DataRowDataRelation을 사용하여 DataRowVersion의 자식 행을 가져옵니다.

GetChildRows(String, DataRowVersion)

DataRow의 지정된 RelationNameDataRelation을 사용하여 DataRowVersion의 자식 행을 가져옵니다.

GetChildRows(DataRelation)

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

지정된 DataRow을 사용하여 이 DataRelation의 자식 행을 가져옵니다.

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

매개 변수

relation
DataRelation

사용할 DataRelation입니다.

반환

DataRow 개체로 이루어진 배열 또는 길이가 0인 배열입니다.

예외

관계와 행이 같은 테이블에 속하지 않는 경우

관계가 null인 경우

행이 테이블에 속하지 않는 경우

행에 이 버전의 데이터가 없는 경우

예제

다음 예제에서는 를 사용하여 GetChildRows 의 모든 자식에 대한 자식 DataRelationDataRow 개체를 DataTable반환합니다. 행에 있는 각 열의 값이 인쇄됩니다.

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]);
                }
            }
        }
    }
}
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

설명

DataTable 에는 속성에서 반환 ChildRelations 하는 개체의 DataRelation 컬렉션도 포함됩니다.

추가 정보

적용 대상

GetChildRows(String)

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

DataRow의 지정된 RelationName을 사용하여 DataRelation의 자식 행을 가져옵니다.

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

매개 변수

relationName
String

사용할 RelationNameDataRelation입니다.

반환

DataRow 개체로 이루어진 배열 또는 길이가 0인 배열입니다.

예외

관계와 행이 같은 테이블에 속하지 않는 경우

행이 테이블에 속하지 않는 경우

설명

DataTable 에는 속성에서 반환 ChildRelations 하는 개체의 DataRelation 컬렉션도 포함됩니다.

적용 대상

GetChildRows(DataRelation, DataRowVersion)

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

지정된 DataRowDataRelation을 사용하여 DataRowVersion의 자식 행을 가져옵니다.

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

매개 변수

relation
DataRelation

사용할 DataRelation입니다.

version
DataRowVersion

가져올 데이터의 버전을 지정하는 DataRowVersion 값 중 하나입니다. 가능한 값은 Default, Original, CurrentProposed입니다.

반환

DataRow 개체의 배열입니다.

예외

관계와 행이 같은 테이블에 속하지 않는 경우

relationnull인 경우

행이 테이블에 속하지 않는 경우

행에 요청한 DataRowVersion이 없는 경우

예제

다음 예제에서는 를 사용하여 GetChildRows 의 모든 자식에 대한 자식 DataRelationDataRow 개체를 DataTable반환합니다. 행에 지정된 버전이 있는 각 열의 값이 인쇄됩니다.

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]);
                }
            }
        }
    }
}
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

설명

DataTable 에는 속성에서 반환 ChildRelations 하는 개체의 DataRelation 컬렉션도 포함됩니다.

사용 하 여는 HasVersion 속성을 원하는 존재 여부를 DataRowVersion 확인 합니다.

가 지정된 경우 Default 사용되는 버전은 호출되는 행의 에 GetChildRows 따라 달라집니다RowState. 호출 RowState 되는 행에 , New또는 UnchangedCurrentModified있는 GetChildRows 경우 행의 버전은 현재 버전에서 일치하는 값이 있는 관련 자식 행을 가져오는 데 사용됩니다. 호출 RowStateDeletedOriginal 되는 행에 의 가 있는 GetChildRows 경우 행의 버전은 원래 버전에서 일치하는 값이 있는 관련 자식 행을 가져오는 데 사용됩니다.

추가 정보

적용 대상

GetChildRows(String, DataRowVersion)

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

DataRow의 지정된 RelationNameDataRelation을 사용하여 DataRowVersion의 자식 행을 가져옵니다.

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

매개 변수

relationName
String

사용할 RelationNameDataRelation입니다.

version
DataRowVersion

가져올 데이터의 버전을 지정하는 DataRowVersion 값 중 하나입니다. 가능한 값은 Default, Original, CurrentProposed입니다.

반환

DataRow 개체로 이루어진 배열 또는 길이가 0인 배열입니다.

예외

관계와 행이 같은 테이블에 속하지 않는 경우

relationnull인 경우

행이 테이블에 속하지 않는 경우

행에 요청한 DataRowVersion이 없는 경우

설명

DataTable 에는 속성에서 반환 ChildRelations 하는 개체의 DataRelation 컬렉션도 포함됩니다.

사용 하 여는 HasVersion 속성을 원하는 존재 여부를 DataRowVersion 확인 합니다.

가 지정된 경우 Default 사용되는 버전은 호출되는 행의 에 GetChildRows 따라 달라집니다RowState. 호출 RowState 되는 행에 , New또는 UnchangedCurrentModified있는 GetChildRows 경우 행의 버전은 현재 버전에서 일치하는 값이 있는 관련 자식 행을 가져오는 데 사용됩니다. 호출 RowStateDeletedOriginal 되는 행에 의 가 있는 GetChildRows 경우 행의 버전은 원래 버전에서 일치하는 값이 있는 관련 자식 행을 가져오는 데 사용됩니다.

적용 대상