DataRowViewとは? わかりやすく解説

DataRowView イベント


DataRowView クラス

DataRow のカスタマイズされたビュー表します

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

Public Class DataRowView
    Implements ICustomTypeDescriptor, IEditableObject, IDataErrorInfo,
 INotifyPropertyChanged
public class DataRowView : ICustomTypeDescriptor,
 IEditableObject, IDataErrorInfo, 
    INotifyPropertyChanged
public ref class DataRowView : ICustomTypeDescriptor,
 IEditableObject, IDataErrorInfo, 
    INotifyPropertyChanged
public class DataRowView implements ICustomTypeDescriptor,
 IEditableObject, 
    IDataErrorInfo, INotifyPropertyChanged
public class DataRowView implements ICustomTypeDescriptor,
 IEditableObject, 
    IDataErrorInfo, INotifyPropertyChanged
解説解説

データを DataGrid コントロールなどで表示する場合、1 行につき 1 つバージョンだけを表示できます表示されている行は DataRowView です。

DataRowView は、DefaultOriginalCurrent、および Proposed という 4 種類バージョン状態のいずれか 1 つなります

DataRow で BeginEdit を呼び出した後で編集した値は Proposed 値になります。CancelEdit または EndEdit のどちらか呼び出すまでは、行には Original バージョンProposed バージョン格納されています。CancelEdit呼び出すと、提示されバージョン破棄され、値が Original戻りますEndEdit呼び出すと、DataRowView には Proposed バージョンなくなり提示された値が現在の値になります既定値は、既定値定義されている列を含む行でだけ使用できます

使用例使用例

RowVersion プロパティ使用してDataRowView 内の行の状態を確認する例を次に示します

Private Sub DemonstrateRowVersion()
    Dim i As Integer
    ' Create a DataTable with one column.
    Dim table As New DataTable("Table")
    Dim column As New DataColumn("Column")
    table.Columns.Add(column)

    ' Add ten rows.
    Dim row As DataRow
    For i = 0 To 9
        row = table.NewRow()
        row("Column") = "item "
 + i.ToString()
        table.Rows.Add(row)
    Next i
    table.AcceptChanges()

    ' Create a DataView with the table.
    Dim view As New DataView(table)

    ' Change one row's value:
    table.Rows(1)("Column") = "Hello"

    ' Add one row:
    row = table.NewRow()
    row("Column") = "World"
    table.Rows.Add(row)

    ' Set the RowStateFilter to display only added and modified rows.
    view.RowStateFilter = _
       DataViewRowState.Added Or DataViewRowState.ModifiedCurrent

    ' Print those rows. Output includes "Hello" and "World".
    PrintView(view, "ModifiedCurrent and Added")

    ' Set filter to display only originals of modified rows.
    view.RowStateFilter = DataViewRowState.ModifiedOriginal
    PrintView(view, "ModifiedOriginal")

    ' Delete three rows.
    table.Rows(1).Delete()
    table.Rows(2).Delete()
    table.Rows(3).Delete()

    ' Set the RowStateFilter to display only deleted rows.
    view.RowStateFilter = DataViewRowState.Deleted
    PrintView(view, "Deleted")

    ' Set filter to display only current rows.
    view.RowStateFilter = DataViewRowState.CurrentRows
    PrintView(view, "Current")

    ' Set filter to display only unchanged rows.
    view.RowStateFilter = DataViewRowState.Unchanged
    PrintView(view, "Unchanged")

    ' Set filter to display only original rows.
    ' Current values of unmodified rows are also returned.
    view.RowStateFilter = DataViewRowState.OriginalRows
    PrintView(view, "OriginalRows")
End Sub

Private Sub PrintView(ByVal
 view As DataView, ByVal label As
 String)
    Console.WriteLine(ControlChars.Cr + label)
    Dim i As Integer
    For i = 0 To view.Count - 1
        Console.WriteLine(view(i)("Column"))
        Console.WriteLine("DataRowView.RowVersion: {0}",
 _
            view(i).RowVersion)
    Next i
End Sub
private static void DemonstrateRowVersion()
{
    // Create a DataTable with one column.
    DataTable table = new DataTable("Table");
    DataColumn column = new DataColumn("Column");
    table.Columns.Add(column);

    // Add ten rows.
    DataRow row;
    for (int i = 0; i < 10; i++)
    {
        row = table.NewRow();
        row["Column"] = "item " + i;
        table.Rows.Add(row);
    }

    table.AcceptChanges();
    // Create a DataView with the table.
    DataView view = new DataView(table);

    // Change one row's value:
    table.Rows[1]["Column"] = "Hello";

    // Add one row:
    row = table.NewRow();
    row["Column"] = "World";
    table.Rows.Add(row);

    // Set the RowStateFilter to display only added 
    // and modified rows.
    view.RowStateFilter = DataViewRowState.Added | 
        DataViewRowState.ModifiedCurrent;

    // Print those rows. Output includes "Hello" and "World".
    PrintView(view, "ModifiedCurrent and Added");

    // Set filter to display only originals of modified rows.
    view.RowStateFilter = DataViewRowState.ModifiedOriginal;
    PrintView(view, "ModifiedOriginal");

    // Delete three rows.
    table.Rows[1].Delete();
    table.Rows[2].Delete();
    table.Rows[3].Delete();

    // Set the RowStateFilter to display only deleted rows.
    view.RowStateFilter = DataViewRowState.Deleted;
    PrintView(view, "Deleted");

    // Set filter to display only current rows.
    view.RowStateFilter = DataViewRowState.CurrentRows;
    PrintView(view, "Current");

    // Set filter to display only unchanged rows.
    view.RowStateFilter = DataViewRowState.Unchanged;
    PrintView(view, "Unchanged");

    // Set filter to display only original rows.
    // Current values of unmodified rows are also returned.
    view.RowStateFilter = DataViewRowState.OriginalRows;
    PrintView(view, "OriginalRows");
}

private static void PrintView(DataView
 view, string label)
{
    Console.WriteLine("\n" + label);
    for (int i = 0; i < view.Count; i++)
    {
        Console.WriteLine(view[i]["Column"]);
        Console.WriteLine("DataViewRow.RowVersion: {0}", 
            view[i].RowVersion);
    }
}
継承階層継承階層
System.Object
  System.Data.DataRowView
スレッド セーフスレッド セーフ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

DataRowView プロパティ


パブリック プロパティパブリック プロパティ

明示的インターフェイスの実装明示的インターフェイス実装
  名前 説明
インターフェイスの明示的な実装 System.ComponentModel.IDataErrorInfo.Item このメンバ説明については、IDataErrorInfo.Item のトピック参照してください
参照参照

関連項目

DataRowView クラス
System.Data 名前空間
DataRow クラス

DataRowView メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
明示的インターフェイスの実装明示的インターフェイス実装
  名前 説明
インターフェイスの明示的な実装 System.ComponentModel.ICustomTypeDescriptor.GetAttributes このメンバ説明については、ICustomTypeDescriptor.GetAttributes のトピック参照してください
インターフェイスの明示的な実装 System.ComponentModel.ICustomTypeDescriptor.GetClassName このメンバ説明については、ICustomTypeDescriptor.GetClassName のトピック参照してください
インターフェイスの明示的な実装 System.ComponentModel.ICustomTypeDescriptor.GetComponentName このメンバ説明については、ICustomTypeDescriptor.GetComponentName のトピック参照してください
インターフェイスの明示的な実装 System.ComponentModel.ICustomTypeDescriptor.GetConverter このメンバ説明については、ICustomTypeDescriptor.GetConverter のトピック参照してください
インターフェイスの明示的な実装 System.ComponentModel.ICustomTypeDescriptor.GetDefaultEvent このメンバ説明については、ICustomTypeDescriptor.GetDefaultEvent のトピック参照してください
インターフェイスの明示的な実装 System.ComponentModel.ICustomTypeDescriptor.GetDefaultProperty このメンバ説明については、ICustomTypeDescriptor.GetDefaultProperty のトピック参照してください
インターフェイスの明示的な実装 System.ComponentModel.ICustomTypeDescriptor.GetEditor このメンバ説明については、ICustomTypeDescriptor.GetEditor のトピック参照してください
インターフェイスの明示的な実装 System.ComponentModel.ICustomTypeDescriptor.GetEvents オーバーロードされます。  
インターフェイスの明示的な実装 System.ComponentModel.ICustomTypeDescriptor.GetProperties オーバーロードされます。  
インターフェイスの明示的な実装 System.ComponentModel.ICustomTypeDescriptor.GetPropertyOwner このメンバ説明については、ICustomTypeDescriptor.GetPropertyOwner のトピック参照してください
参照参照

関連項目

DataRowView クラス
System.Data 名前空間
DataRow クラス

DataRowView メンバ

DataRow のカスタマイズされたビュー表します

DataRowView データ型公開されるメンバを以下の表に示します


パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
パブリック イベントパブリック イベント
  名前 説明
パブリック イベント PropertyChanged DataRowView プロパティ変更時に発生するイベント
明示的インターフェイスの実装明示的インターフェイス実装
  名前 説明
インターフェイスの明示的な実装 System.ComponentModel.ICustomTypeDescriptor.GetAttributes このメンバ説明については、ICustomTypeDescriptor.GetAttributes のトピック参照してください
インターフェイスの明示的な実装 System.ComponentModel.ICustomTypeDescriptor.GetClassName このメンバ説明については、ICustomTypeDescriptor.GetClassName のトピック参照してください
インターフェイスの明示的な実装 System.ComponentModel.ICustomTypeDescriptor.GetComponentName このメンバ説明については、ICustomTypeDescriptor.GetComponentName のトピック参照してください
インターフェイスの明示的な実装 System.ComponentModel.ICustomTypeDescriptor.GetConverter このメンバ説明については、ICustomTypeDescriptor.GetConverter のトピック参照してください
インターフェイスの明示的な実装 System.ComponentModel.ICustomTypeDescriptor.GetDefaultEvent このメンバ説明については、ICustomTypeDescriptor.GetDefaultEvent のトピック参照してください
インターフェイスの明示的な実装 System.ComponentModel.ICustomTypeDescriptor.GetDefaultProperty このメンバ説明については、ICustomTypeDescriptor.GetDefaultProperty のトピック参照してください
インターフェイスの明示的な実装 System.ComponentModel.ICustomTypeDescriptor.GetEditor このメンバ説明については、ICustomTypeDescriptor.GetEditor のトピック参照してください
インターフェイスの明示的な実装 System.ComponentModel.ICustomTypeDescriptor.GetEvents オーバーロードされます。  
インターフェイスの明示的な実装 System.ComponentModel.ICustomTypeDescriptor.GetProperties オーバーロードされます。  
インターフェイスの明示的な実装 System.ComponentModel.ICustomTypeDescriptor.GetPropertyOwner このメンバ説明については、ICustomTypeDescriptor.GetPropertyOwner のトピック参照してください
インターフェイスの明示的な実装 System.ComponentModel.IDataErrorInfo.Item このメンバ説明については、IDataErrorInfo.Item のトピック参照してください
参照参照

関連項目

DataRowView クラス
System.Data 名前空間
DataRow クラス



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

辞書ショートカット

すべての辞書の索引

「DataRowView」の関連用語

DataRowViewのお隣キーワード
検索ランキング

   

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



DataRowViewのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS