HasOriginalValues Property
The HasOriginalValues property indicates whether a data row
currently holds a snapshot of its original (baseline) values.
This snapshot is created automatically by the framework when an
Unchanged row is modified for the first time, or when the
Delete method is called.
The snapshot represents the baseline state of the row and is used by the
RejectChanges method to restore the row to its original values.
When AcceptChanges is called for Added or Modified rows,
the snapshot is discarded and the current values become the new baseline.
If a row does not contain a snapshot of original values, the
HasOriginalValues property returns false.
Namespace: PocoDataSet.Data
Assembly: PocoDataSet.Data.dll
// 1. Create an empty data set
IDataSet dataSet = DataSetFactory.CreateDataSet();
// 2. Create an empty data table
IDataTable departmentDataTable = dataSet.AddNewTable("Department");
departmentDataTable.AddColumn("Id", DataTypeNames.INT32);
departmentDataTable.AddColumn("Name", DataTypeNames.STRING);
// 3. Create a new row by AddNewRow method on data table, the row state is Added
IDataRow departmentDataRow = departmentDataTable.AddNewRow();
departmentDataRow["Name"] = "Emergency";
// 4. Verify whether row contains the snapshot of original values, expected false
bool dataRowHasOriginalValues = departmentDataRow.HasOriginalValues;
// 5. Call AcceptChanges method to set row state into Unchanged
departmentDataRow.AcceptChanges();
// 6. Verify whether row contains the snapshot of original values, expected false
dataRowHasOriginalValues = departmentDataRow.HasOriginalValues;
// 7. Modify row data to put it into Modified state
departmentDataRow["Name"] = "Reception";
// 8. Verify whether row contains the snapshot of original values, expected true
// because the modification of any value of row creates snapshot of original values
dataRowHasOriginalValues = departmentDataRow.HasOriginalValues;
// 9. Call RejectChanges method to put row back in the state before modifications occurred
departmentDataRow.RejectChanges();
// 10. Verify whether row contains the snapshot of original values, expected false
dataRowHasOriginalValues = departmentDataRow.HasOriginalValues;
// 11. Modify row data again to put it into Modified state
departmentDataRow["Name"] = "Reception";
// 12. Verify whether row contains the snapshot of original values, expected true
// because the modification of any value of row creates snapshot of original values
dataRowHasOriginalValues = departmentDataRow.HasOriginalValues;
// 13. Call AcceptChanges method to put row into Unchanged state
departmentDataRow.AcceptChanges();
// 14. Verify whether row contains the snapshot of original values, expected false
// because the AccepChanges method removes the snapshot of original values
dataRowHasOriginalValues = departmentDataRow.HasOriginalValues;
// 15. Call Delete method to put row into deleted state
departmentDataRow.Delete();
// 16. Verify whether row contains the snapshot of original values, expected true
// because the Delete method creates snapshot of original values
dataRowHasOriginalValues = departmentDataRow.HasOriginalValues;
Table of Content POCO DataSet API References POCO DataSet Types DataRow Members
Business Process Programming in .Net
© 2004–2026 Laskarzhevsky Software Inc.
Unless otherwise noted, the content of this website is licensed under the
Creative Commons Attribution 4.0 International License (CC BY 4.0).
Code examples are provided under the MIT License.
You are free to share and adapt the material provided that appropriate
credit is given and any modifications are clearly indicated.
The information provided on this website is for educational purposes only.
The author and publisher make no warranties regarding the completeness
or suitability of the information and are not responsible for any damages
resulting from its use.