共用方式為


DataRow.Table 屬性

定義

取得 DataTable 該列有結構的 。

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

屬性值

DataTable這場爭論所屬的。

範例

以下範例利用 屬性 Table 回傳欄位集合 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

備註

A DataRow 不一定屬於任何資料表的列集合。 此行為發生在 已被 DataRow 建立但尚未加入 DataRowCollection時。 若屬性 RowState 回傳 DataRowState.Detached,該列不在任何集合中。

適用於

另請參閱