Sdílet prostřednictvím


DataRow.Table Vlastnost

Definice

Získá, DataTable pro který má tento řádek schéma.

public:
 property System::Data::DataTable ^ Table { System::Data::DataTable ^ get(); };
public System.Data.DataTable Table { get; }
member this.Table : System.Data.DataTable
Public ReadOnly Property Table As DataTable

Hodnota vlastnosti

Do DataTable kterého tento řádek patří.

Příklady

Následující příklad používá Table vlastnost k vrácení odkazu na sloupce kolekce DataTable.

private void GetTable(DataRow row)
{
    // Get the DataTable of a DataRow
    DataTable table = row.Table;

    // Print the DataType of each column in the table.
    foreach(DataColumn column in table.Columns)
    {
        Console.WriteLine(column.DataType);
    }
}
Private Sub GetTable(ByVal row As DataRow)
   ' Get the DataTable of a DataRow
   Dim table As DataTable = row.Table

   ' Print the DataType of each column in the table.
   Dim column As DataColumn
   For Each column in table.Columns
      Console.WriteLine(column.DataType)
   Next
End Sub

Poznámky

A DataRow nemusí nutně patřit do žádné kolekce řádků tabulky. K tomuto chování dochází při DataRow vytvoření, ale není přidán do DataRowCollectionsouboru . Pokud se RowState tato vlastnost vrátí DataRowState.Detached, řádek není v žádné kolekci.

Platí pro

Viz také