次の方法で共有


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

注釈

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

適用対象

こちらもご覧ください