RowVersion Property

DataRowView.RowVersion Property


Gets the current version description of the DataRow.

Namespace:   System.Data
Assembly:  System.Data (in System.Data.dll)

public DataRowVersion RowVersion { get; }

Property Value

Type: System.Data.DataRowVersion

One of the DataRowVersion values. Possible values for the RowVersion property are Default, Original, Current, and Proposed.

The RowStateFilter property specifies both DataRowState and DataRowVersion settings. For more information, see DataRowState, DataRowVersion, and DataViewRowState.

The following example uses the RowVersion property to display the DataRowVersion.

private static void DemonstrateRowVersion()
    // Create a DataTable with one column.
    DataTable table = new DataTable("Table");
    DataColumn column = new DataColumn("Column");

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

    // 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";

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

    // 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.

    // 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("DataViewRow.RowVersion: {0}", 

.NET Framework
Available since 1.1
Return to top
© 2015 Microsoft