DataSet.HasChanges is true even immediately after TableAdapter.Update is run

Posted by Nathan Koop on Stack Overflow See other posts from Stack Overflow or by Nathan Koop
Published on 2010-03-12T19:06:15Z Indexed on 2010/03/12 19:37 UTC
Read the original article Hit count: 285

Filed under:
|
|
|

I've got some legacy dataset code which I'm updating. I'm attempting to determine if the dataset has changes to it so I can properly prompt for a save request. However myDataset.HasChanges() always returns true.

In my save method I've edited the code to determine when the dataset get's changes and made the code like this:

1. myBindingSource.EndEdit()
2. myTableAdapter.Update(myDataSet)
3. myBindingSource.EndEdit()

After line 1, - myDataSet.HasChanges = true (understandable)
After line 2, - myDataSet.HasChanges = false (understandable)
After line 3, - myDataSet.HasChanges = true

I'm unsure of why this would occur in line 3, shouldn't this be false because I just ran the updates on the dataset?

© Stack Overflow or respective owner

Related posts about dataset

Related posts about tableadapter