DataView.Table プロパティとは? わかりやすく解説

DataView.Table プロパティ

ソース DataTable を取得または設定します

名前空間: System.Data
アセンブリ: System.Data (system.data.dll 内)
構文構文

Dim instance As DataView
Dim value As DataTable

value = instance.Table

instance.Table = value
public DataTable Table { get; set;
 }
public:
property DataTable^ Table {
    DataTable^ get ();
    void set (DataTable^ value);
}
/** @property */
public DataTable get_Table ()

/** @property */
public void set_Table (DataTable value)

プロパティ
このビューデータ提供する DataTable

解説解説

DataTable には、テーブル既定の DataView を返す DefaultView プロパティあります。たとえば、テーブルカスタム ビュー作成する場合は、DefaultView によって返されDataView に対して RowFilter を設定します

現在の値が null場合は、Table プロパティだけを設定できます

使用例使用例

現在の DataViewDataTable取得する例を次に示します

Private Sub DemonstrateDataViewTable()
    Dim table As DataTable = New
 DataTable()

    ' add columns
    Dim column As DataColumn = table.Columns.Add("ProductID",
 GetType(Integer))
    column.AutoIncrement = True
    column = table.Columns.Add("ProductName", GetType(String))

    ' populate DataTable.
    Dim id As Integer
    For id = 1 To 5
        table.Rows.Add(New Object() {id, String.Format("product{0}",
 id)})
    Next id

    Dim view As DataView = New
 DataView(table)

    PrintTable(view.Table, "DataTable")
End Sub

Private Sub PrintTable(ByVal
 table As DataTable, ByVal label As
 String)
    ' This function prints values in the table or DataView.
    Console.WriteLine("\n" + label)
    Dim row As DataRow
    Dim column As DataColumn
    For Each row In table.Rows
        For Each column In
 table.Columns
            Console.Write("\table{0}", row(column))
        Next column
    Next row
    Console.WriteLine()
End Sub
private static void DemonstrateDataViewTable()
{
    DataTable table = new DataTable();

    // add columns
    DataColumn column = table.Columns.Add("ProductID",
        typeof(int)    );
    column.AutoIncrement = true;
    column = table.Columns.Add("ProductName", 
        typeof(string));

    // populate DataTable.
    for(int id=1; id<=5; id++)
    {
        table.Rows.Add(
            new object[]{ id, string.Format("product{0}",
 id) });
    }

    DataView view = new DataView(table);

    PrintTable(view.Table, "DataTable");
}

private static void PrintTable(DataTable
 table, string label)
{
    // This function prints values in the table or DataView.
    Console.WriteLine("\n" + label);
    foreach(DataRow row in table.Rows)
    {
        foreach(DataColumn column in table.Columns)
        {
            Console.Write("\table{0}", row[column]);
        }
        Console.WriteLine();
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「DataView.Table プロパティ」の関連用語

DataView.Table プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DataView.Table プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS