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 patří tento řádek.

Příklady

Následující příklad používá Table vlastnost k vrácení odkazu na kolekci sloupců objektu 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 kolekce řádků žádné tabulky. K tomuto chování dochází, DataRow když byl vytvořen, ale nebyl přidán do objektu DataRowCollection. Pokud vlastnost RowState vrátí DataRowState.Detached, řádek není v žádné kolekci.

Platí pro

Viz také