DataRow.Table Właściwość

Definicja

Pobiera schemat DataTable , dla którego ten wiersz ma schemat.

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

Wartość właściwości

Do DataTable którego należy ten wiersz.

Przykłady

W poniższym przykładzie użyto Table właściwości , aby zwrócić odwołanie do kolekcji kolumn obiektu 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

Uwagi

Obiekt DataRow nie musi należeć do kolekcji wierszy tabeli. To zachowanie występuje, gdy DataRow element został utworzony, ale nie został dodany do elementu DataRowCollection. RowState Jeśli właściwość zwróci DataRowState.Detachedwartość , wiersz nie znajduje się w żadnej kolekcji.

Dotyczy

Zobacz też