DataRow.Table Proprietà

Definizione

Ottiene l'oggetto DataTable di cui è presente uno schema in questa riga.

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

Valore della proprietà

DataTable

Oggetto DataTable cui appartiene questa riga.

Esempio

Nell'esempio seguente viene usata la Table proprietà per restituire un riferimento all'insieme DataTablecolumns di .

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

Commenti

Un DataRow oggetto non appartiene necessariamente alla raccolta di righe di una tabella. Questo comportamento si verifica quando è DataRow stato creato ma non aggiunto a DataRowCollection. Se la proprietà restituisce DataRowState.Detached, la RowState riga non è presente in alcuna raccolta.

Si applica a

Vedi anche