DataRow.Table Property


获取该行拥有其架构的 DataTableGets 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


该行所属的 DataTableThe DataTable to which this row belongs.


下面的示例使用 Table 属性返回对 DataTable的列集合的引用。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


DataRow 不一定属于任何表的行集合。A DataRow does not necessarily belong to any table's collection of rows. 如果 DataRow 已创建但未添加到 DataRowCollection中,则会出现此行为。This behavior occurs when the DataRow has been created but not added to the DataRowCollection. 如果 RowState 属性返回 DataRowState.Detached,则该行不在任何集合中。If the RowState property returns DataRowState.Detached, the row is not in any collection.

Applies to

See also