I have a datatable that is filled from a database. I load a bindingsource with that table.
Sub LoadData()
Dim bsTemp As BindingSource = New BindingSource
bsTemp.DataSource = dtTemp
End Sub
I then have other code programmatically editing the values in the datatable. I NEVER call AcceptChanges() ..let me be clear NEVER.
I do call bsTem.EndEdit() and I also call that on my dtTemp.Row(x).EndEdit() Whenever I make a change to it.
So now all I want to do is compare the two rows (I know I can do this with a for each column but I am not wanting to do that.)
I would like to know how to make this work:
Dim modview As New DataView(dtTemp.Copy, "", "Id", DataViewRowState.ModifiedCurrent)
Dim origView As New DataView(dtTemp.Copy, "", "Id", DataViewRowState.ModifiedOriginal)
So I can then perform something like this:
Dim rowComparer As DataRowComparer(Of DataRow) = DataRowComparer.Default
IsEqual = rowComparer.Equals(origRow.Row, modRow.Row)
When I do this both views show the Modified data, one of them should only show me the Original unmodified Row.
I know I can do this [C# version]:
SomeDataRow[0, DataRowVersion.Original] //by index
SomeDataRow["ColumnName", DataRowVersion.Original]
But again tis works on a column by column basis - me being the iterator - and I see no reason to do that when the DataView supposedly has this built in . So what could I be doing wrong that I do not see the original version .