DataRow.GetParentRows Método

Definición

Obtiene las filas primarias de DataRow.

Sobrecargas

GetParentRows(DataRelation, DataRowVersion)

Obtiene las filas primarias de DataRow mediante el DataRelation especificado y DataRowVersion.

GetParentRows(DataRelation)

Obtiene las filas primarias de DataRow mediante el DataRelation especificado.

GetParentRows(String)

Obtiene las filas primarias de DataRow mediante el RelationName especificado de un DataRelation.

GetParentRows(String, DataRowVersion)

Obtiene las filas primarias de un DataRow mediante el RelationName especificado de un DataRelation y DataRowVersion.

GetParentRows(DataRelation, DataRowVersion)

Obtiene las filas primarias de DataRow mediante el DataRelation especificado y DataRowVersion.

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

Parámetros

relation
DataRelation

Objeto DataRelation que se va a usar.

version
DataRowVersion

Uno de los valores de DataRowVersion que especifica la versión de los datos que se va a obtener.

Devoluciones

Matriz de objetos DataRow o una matriz de longitud cero.

Excepciones

DataRelation no pertenece al DataSet de esta fila.

La fila es null.

La tabla secundaria de la relación no es la tabla a la que pertenece la fila.

La fila no pertenece a DataTable.

La fila no tiene el DataRowVersion solicitado.

Ejemplos

En el ejemplo siguiente se usa para GetParentRows devolver los objetos secundarios DataRow de cada elemento secundario DataRelation de .DataTable A continuación, se imprime el valor de cada columna de la fila.

Private Sub GetChildRowsFromDataRelation(table As DataTable, ver As DataRowVersion)
    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.ParentRelations
      For Each row In table.Rows
          arrRows = row.GetParentRows(relation, ver)
          ' Print values of rows.
          For i = 0 To arrRows.GetUpperBound(0)
             For Each column in table.Columns
                Console.WriteLine(arrRows(i)(column.ColumnName))
             Next column
          Next i
       Next row
    Next relation
End Sub

Comentarios

En un DataSet, el método devuelve GetParentRows la colección de todos los objetos primarios DataRelation para el conjunto de datos.

DataTable También contiene una colección de DataRelation objetos devueltos por la ParentRelations propiedad .

Utilice la HasVersion propiedad para determinar si existe el DataRowVersion que desea.

Consulte también

Se aplica a

GetParentRows(DataRelation)

Obtiene las filas primarias de DataRow mediante el DataRelation especificado.

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

Parámetros

relation
DataRelation

Objeto DataRelation que se va a usar.

Devoluciones

Matriz de objetos DataRow o una matriz de longitud cero.

Excepciones

DataRelation no pertenece al DataSet de esta fila.

La fila es null.

La tabla secundaria de la relación no es la tabla a la que pertenece la fila.

La fila no pertenece a DataTable.

Ejemplos

En el ejemplo siguiente se usa para GetParentRows devolver los objetos secundarios DataRow de cada elemento secundario DataRelation de .DataTable A continuación, se imprime el valor de cada columna de la fila.

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.ParentRelations
      For Each row In table.Rows
          arrRows = row.GetParentRows(relation)
          ' Print values of rows.
          For i = 0 To arrRows.GetUpperBound(0)
             For Each column in table.Columns
                Console.WriteLine(arrRows(i)(column.ColumnName))
             Next column
          Next i
       Next row
    Next relation
 End Sub

Comentarios

En un DataSet, el método devuelve GetParentRows la colección de todos los objetos primarios DataRelation para el conjunto de datos.

DataTable También contiene una colección de DataRelation objetos devueltos por la ParentRelations propiedad .

Consulte también

Se aplica a

GetParentRows(String)

Obtiene las filas primarias de DataRow mediante el RelationName especificado de un DataRelation.

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

Parámetros

relationName
String

RelationName de un DataRelation.

Devoluciones

Matriz de objetos DataRow o una matriz de longitud cero.

Excepciones

La relación y la fila no pertenecen a la misma tabla.

La fila no pertenece a la tabla.

Comentarios

En un DataSet, el método devuelve GetParentRows la colección de todos los objetos primarios DataRelation para el conjunto de datos.

DataTable También contiene una colección de DataRelation objetos devueltos por la ParentRelations propiedad .

Se aplica a

GetParentRows(String, DataRowVersion)

Obtiene las filas primarias de un DataRow mediante el RelationName especificado de un DataRelation y DataRowVersion.

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

Parámetros

relationName
String

RelationName de un DataRelation.

version
DataRowVersion

Uno de los valores de DataRowVersion que especifica la versión de los datos que se va a obtener. Los valores posibles son Default, Original, Current y Proposed.

Devoluciones

Matriz de objetos DataRow o una matriz de longitud cero.

Excepciones

La relación y la fila no pertenecen a la misma tabla.

El valor de relation es null.

La fila no pertenece a la tabla.

La fila no tiene el DataRowVersion solicitado.

Comentarios

En un DataSet, el método devuelve GetParentRows la colección de todos los objetos primarios DataRelation para el conjunto de datos.

DataTable También contiene una colección de DataRelation objetos devueltos por la ParentRelations propiedad .

Utilice la HasVersion propiedad para determinar si existe el DataRowVersion que desea.

Se aplica a