DataRow.GetParentRows Metoda
Definicja
Przeciążenia
GetParentRows(DataRelation, DataRowVersion) |
Pobiera wiersze nadrzędne DataRow , używając określonych elementów DataRelation i DataRowVersion .Gets the parent rows of a DataRow using the specified DataRelation, and DataRowVersion. |
GetParentRows(DataRelation) |
Pobiera wiersze nadrzędne, DataRow używając określonego DataRelation .Gets the parent rows of a DataRow using the specified DataRelation. |
GetParentRows(String) |
Pobiera wiersze nadrzędne, DataRow używając określonego elementu RelationName DataRelation .Gets the parent rows of a DataRow using the specified RelationName of a DataRelation. |
GetParentRows(String, DataRowVersion) |
Pobiera wiersze nadrzędne DataRow , używając określonych RelationName elementów DataRelation i DataRowVersion .Gets the parent rows of a DataRow using the specified RelationName of a DataRelation, and DataRowVersion. |
GetParentRows(DataRelation, DataRowVersion)
Pobiera wiersze nadrzędne DataRow , używając określonych elementów DataRelation i DataRowVersion .Gets the parent rows of a DataRow using the specified DataRelation, and 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()
Parametry
- relation
- DataRelation
DataRelationDo użycia.The DataRelation to use.
- version
- DataRowVersion
Jedna z DataRowVersion wartości określająca wersję danych do pobrania.One of the DataRowVersion values specifying the version of the data to get.
Zwraca
- DataRow[]
Tablica DataRow obiektów lub tablica o długości zero.An array of DataRow objects or an array of length zero.
Wyjątki
Nie DataRelation należy do tego wiersza DataSet .The DataRelation does not belong to this row's DataSet.
Wiersz jest null
.The row is null
.
Tabela podrzędna relacji nie jest tabelą, do której należy wiersz.The relation's child table is not the table the row belongs to.
Wiersz nie ma żądanego żądania DataRowVersion .The row does not have the requested DataRowVersion.
Przykłady
Poniższy przykład używa GetParentRows do zwracania DataRow obiektów podrzędnych dla każdego elementu podrzędnego DataRelation w DataTable .The following example uses the GetParentRows to return the child DataRow objects for every child DataRelation in a DataTable. Następnie drukowana jest wartość każdej kolumny w wierszu.The value of each column in the row is then printed.
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
Uwagi
W DataSet , Kolekcja wszystkich obiektów nadrzędnych DataRelation dla zestawu danych jest zwracana przez GetParentRows metodę.In a DataSet, the collection of all parent DataRelation objects for the data set is returned by the GetParentRows method.
DataTableZawiera również kolekcję DataRelation obiektów zwracaną przez ParentRelations Właściwość.The DataTable also contains a collection of DataRelation objects, returned by the ParentRelations property.
Użyj HasVersion właściwości, aby określić, czy DataRowVersion ma ona istnieć.Use the HasVersion property to determine whether the DataRowVersion that you want exists.
Zobacz też
Dotyczy
GetParentRows(DataRelation)
Pobiera wiersze nadrzędne, DataRow używając określonego DataRelation .Gets the parent rows of a DataRow using the specified DataRelation.
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()
Parametry
- relation
- DataRelation
DataRelationDo użycia.The DataRelation to use.
Zwraca
- DataRow[]
Tablica DataRow obiektów lub tablica o długości zero.An array of DataRow objects or an array of length zero.
Wyjątki
Nie DataRelation należy do tego wiersza DataSet .The DataRelation does not belong to this row's DataSet.
Wiersz jest null
.The row is null
.
Tabela podrzędna relacji nie jest tabelą, do której należy wiersz.The relation's child table is not the table the row belongs to.
Przykłady
Poniższy przykład używa GetParentRows do zwracania DataRow obiektów podrzędnych dla każdego elementu podrzędnego DataRelation w DataTable .The following example uses the GetParentRows to return the child DataRow objects for every child DataRelation in a DataTable. Następnie drukowana jest wartość każdej kolumny w wierszu.The value of each column in the row is then printed.
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
Uwagi
W DataSet , Kolekcja wszystkich obiektów nadrzędnych DataRelation dla zestawu danych jest zwracana przez GetParentRows metodę.In a DataSet, the collection of all parent DataRelation objects for the data set is returned by the GetParentRows method.
DataTableZawiera również kolekcję DataRelation obiektów zwracaną przez ParentRelations Właściwość.The DataTable also contains a collection of DataRelation objects, returned by the ParentRelations property.
Zobacz też
Dotyczy
GetParentRows(String)
Pobiera wiersze nadrzędne, DataRow używając określonego elementu RelationName DataRelation .Gets the parent rows of a DataRow using the specified RelationName of a 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()
Parametry
- relationName
- String
RelationNameA DataRelation .The RelationName of a DataRelation.
Zwraca
- DataRow[]
Tablica DataRow obiektów lub tablica o długości zero.An array of DataRow objects or an array of length zero.
Wyjątki
Relacja i wiersz nie należą do tej samej tabeli.The relation and row do not belong to the same table.
Wiersz nie należy do tabeli.The row does not belong to the table.
Uwagi
W DataSet , Kolekcja wszystkich obiektów nadrzędnych DataRelation dla zestawu danych jest zwracana przez GetParentRows metodę.In a DataSet, the collection of all parent DataRelation objects for the data set is returned by the GetParentRows method.
DataTableZawiera również kolekcję DataRelation obiektów zwracaną przez ParentRelations Właściwość.The DataTable also contains a collection of DataRelation objects, returned by the ParentRelations property.
Dotyczy
GetParentRows(String, DataRowVersion)
Pobiera wiersze nadrzędne DataRow , używając określonych RelationName elementów DataRelation i DataRowVersion .Gets the parent rows of a DataRow using the specified RelationName of a DataRelation, and 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()
Parametry
- relationName
- String
RelationNameA DataRelation .The RelationName of a DataRelation.
- version
- DataRowVersion
Jedna z DataRowVersion wartości określająca wersję danych do pobrania.One of the DataRowVersion values specifying the version of the data to get. Możliwe wartości to Default
, Original
, Current
, i Proposed
.Possible values are Default
, Original
, Current
, and Proposed
.
Zwraca
- DataRow[]
Tablica DataRow obiektów lub tablica o długości zero.An array of DataRow objects or an array of length zero.
Wyjątki
Relacja i wiersz nie należą do tej samej tabeli.The relation and row do not belong to the same table.
relation
Ma wartość null
.The relation
is null
.
Wiersz nie należy do tabeli.The row does not belong to the table.
Wiersz nie ma żądanego żądania DataRowVersion .The row does not have the requested DataRowVersion.
Uwagi
W DataSet , Kolekcja wszystkich obiektów nadrzędnych DataRelation dla zestawu danych jest zwracana przez GetParentRows metodę.In a DataSet, the collection of all parent DataRelation objects for the data set is returned by the GetParentRows method.
DataTableZawiera również kolekcję DataRelation obiektów zwracaną przez ParentRelations Właściwość.The DataTable also contains a collection of DataRelation objects, returned by the ParentRelations property.
Użyj HasVersion właściwości, aby określić, czy DataRowVersion ma ona istnieć.Use the HasVersion property to determine whether the DataRowVersion that you want exists.