DataRow.GetParentRow 메서드

정의

DataRow의 부모 행을 가져옵니다.

오버로드

GetParentRow(DataRelation)

지정된 DataRow을 사용하여 DataRelation의 부모 행을 가져옵니다.

GetParentRow(String)

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

GetParentRow(DataRelation, DataRowVersion)

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

GetParentRow(String, DataRowVersion)

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

GetParentRow(DataRelation)

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

지정된 DataRow을 사용하여 DataRelation의 부모 행을 가져옵니다.

public:
 System::Data::DataRow ^ GetParentRow(System::Data::DataRelation ^ relation);
public System.Data.DataRow? GetParentRow (System.Data.DataRelation? relation);
public System.Data.DataRow GetParentRow (System.Data.DataRelation relation);
member this.GetParentRow : System.Data.DataRelation -> System.Data.DataRow
Public Function GetParentRow (relation As DataRelation) As DataRow

매개 변수

relation
DataRelation

사용할 DataRelation입니다.

반환

현재 행의 부모 DataRow를 반환합니다.

예외

relationDataTable에 속하지 않는 경우

또는

행이 null인 경우

자식 행에 여러 부모가 있습니다.

이 행이 DataRelation 개체의 자식 테이블에 속하지 않는 경우

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

예제

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

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

설명

에서 DataSet데이터 집합에 대한 모든 부모 DataRelation 개체의 컬렉션은 메서드에서 GetParentRows 반환됩니다.

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

추가 정보

적용 대상

GetParentRow(String)

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

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

public:
 System::Data::DataRow ^ GetParentRow(System::String ^ relationName);
public System.Data.DataRow? GetParentRow (string? relationName);
public System.Data.DataRow GetParentRow (string relationName);
member this.GetParentRow : string -> System.Data.DataRow
Public Function GetParentRow (relationName As String) As DataRow

매개 변수

relationName
String

RelationNameDataRelation

반환

현재 행의 부모 DataRow를 반환합니다.

예외

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

자식 행에 여러 부모가 있습니다.

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

예제

다음 예제에서는 를 사용하여 GetParentRow 의 각 부모 행 DataRow 에서 값을 인쇄합니다 DataTable.

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

설명

에서 DataSet데이터 집합에 대한 모든 부모 DataRelation 개체의 컬렉션은 메서드에서 GetParentRows 반환됩니다.

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

적용 대상

GetParentRow(DataRelation, DataRowVersion)

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

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

public:
 System::Data::DataRow ^ GetParentRow(System::Data::DataRelation ^ relation, System::Data::DataRowVersion version);
public System.Data.DataRow? GetParentRow (System.Data.DataRelation? relation, System.Data.DataRowVersion version);
public System.Data.DataRow GetParentRow (System.Data.DataRelation relation, System.Data.DataRowVersion version);
member this.GetParentRow : System.Data.DataRelation * System.Data.DataRowVersion -> System.Data.DataRow
Public Function GetParentRow (relation As DataRelation, version As DataRowVersion) As DataRow

매개 변수

relation
DataRelation

사용할 DataRelation입니다.

version
DataRowVersion

가져올 데이터의 버전을 지정하는 DataRowVersion 값 중 하나입니다.

반환

현재 행의 부모 DataRow를 반환합니다.

예외

행이 null인 경우

또는

relation이 이 테이블의 부모 관계에 속하지 않는 경우

자식 행에 여러 부모가 있습니다.

관계의 자식 테이블이 행이 속한 테이블이 아닌 경우

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

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

예제

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

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

설명

에서 DataSet데이터 집합에 대한 모든 부모 DataRelation 개체의 컬렉션은 메서드에서 GetParentRows 반환됩니다.

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

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

추가 정보

적용 대상

GetParentRow(String, DataRowVersion)

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

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

public:
 System::Data::DataRow ^ GetParentRow(System::String ^ relationName, System::Data::DataRowVersion version);
public System.Data.DataRow? GetParentRow (string? relationName, System.Data.DataRowVersion version);
public System.Data.DataRow GetParentRow (string relationName, System.Data.DataRowVersion version);
member this.GetParentRow : string * System.Data.DataRowVersion -> System.Data.DataRow
Public Function GetParentRow (relationName As String, version As DataRowVersion) As DataRow

매개 변수

relationName
String

RelationNameDataRelation

version
DataRowVersion

DataRowVersion 값 중 하나입니다.

반환

현재 행의 부모 DataRow를 반환합니다.

예외

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

relationnull인 경우

자식 행에 여러 부모가 있습니다.

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

행에 요청한 DataRowVersion이 없는 경우

예제

다음 예제에서는 를 사용하여 GetParentRow 의 각 부모 행 DataRow 에서 값을 인쇄합니다 DataTable.

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

설명

에서 DataSet데이터 집합에 대한 모든 부모 DataRelation 개체의 컬렉션은 메서드에서 GetParentRows 반환됩니다.

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

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

적용 대상