Thanks Peter. Sorry, of course that wasn't a 'real' snippet of code. It was
an overly simplified version of what I'm using. Here's a more detailed
overview of what I'm doing,
// Create the DataSet
DataSet clientData = new DataSet();
// Fill it with a bunch of DataTables and DataRows
// Allow the user to edit the data through a UI
// Get the changes
// Save them to a database
// Just image the code is here, cause it is in my app.
// Call AcceptChanges (because the changes were just saved to the db and so
HasChanges() will return false)
clientData.AcceptChanges();
// Verify HasChanges() is false
Debug.Assert( ! clientData.HasChanges());
Ok now the weird behavior I'm experiencing is, sometimes HasChanges()
returns True after I just called AcceptChanges(). Should this ever happen?
The MSDN API docs give me the impression that HasChanges() should always
return False if called immediately after AcceptChanges(), am I wrong (or
smoking crack)?
My app calls HasChanges() all over the place to determine if the dataset is
in a state OK to discard (i.e. it contains NO changes that need to be saved
to the database). One of our testers started hitting weird bugs which I
tracked down to AcceptChanges() not doing its job (or what I understand to
be its job). That's what lead me to put the Assert right after the
AcceptChanges() call.
clientData.AcceptChanges();
Debug.Assert( ! clientData.HasChanges());
So now our testers hit that failed assert occasionally. And I'm back to
wondering should HasChanges() in this context return True or am I smoking
too much crack? Help!
Matt