Dataset says record was updated, but it wasn't - why?

J

JohnR

I load a table into a dataset and when I click my SAVE button, I get the
changes like this:
dsChanged = ds.GetChanges()
I then parse each row in dsChanged and have found that some of the rows are
marked as 'modified' when I didn't change any values in the record. I then
created a routine that would take this row and for each field in the row it
would compare the DataRowVersion.Original to the DataRowVersion.Current
values. If they were different I would display the differences in a listbox
for me to see.
What's happening is that the listbox contains no changes, unless I really do
change a field... then my change does show.

My question is this... what would cause the dataset to set the 'modified'
flag on a record when it was not changed? I'm at a total loss as to why
this would happen. It must be something I'm doing wrong, but I can't figure
it out. Any suggestions?

John
 
B

Bart Mermuys

Hi,

JohnR said:
I load a table into a dataset and when I click my SAVE button, I get the
changes like this:
dsChanged = ds.GetChanges()
I then parse each row in dsChanged and have found that some of the rows
are marked as 'modified' when I didn't change any values in the record. I
then created a routine that would take this row and for each field in the
row it would compare the DataRowVersion.Original to the
DataRowVersion.Current values. If they were different I would display the
differences in a listbox for me to see.

Even when you assign the _same_ value to a certain row/field then the row
will be marked as modified. So even when all Original values are the same
as Current values the row can still be in a modified state.

So something is actuallly setting the same values. Could be caused by
binding to a Control property that doesn't have a Changed event or a Changed
event that fires even when the new property value is the same as the old
one.

Or maybe you're assigning the same values yourself somewhere, hard to say
without more information.

HTH,
Greetings
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top