DataRow.Table Property


Gets the DataTable for which this row has a schema.

 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

Property Value


The DataTable to which this row belongs.


The following example uses the Table property to return a reference to the columns collection of the 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)
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
End Sub


A DataRow does not necessarily belong to any table's collection of rows. This behavior occurs when the DataRow has been created but not added to the DataRowCollection. If the RowState property returns DataRowState.Detached, the row is not in any collection.

Applies to

See also