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 使用して、 の columns コレクションへの参照を 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

注釈

DataRow 、必ずしもテーブルの行のコレクションに属しているわけではありません。 この動作は、 が作成されたが に追加されていない場合 DataRow に発生します DataRowCollection。 プロパティが を RowState 返す DataRowState.Detached場合、行はどのコレクションにも含まれません。

適用対象

こちらもご覧ください