djpaz25 Posted November 12, 2003 Posted November 12, 2003 I'm having a problem with my program not recognizing changes in a dataset. I have some text boxes bound to fields in a dataset. I retrieve the data OK and modify the value in the text box. Through the debugger, I verify that the value in the dataset has been changed, e.g. dstest.tablename(0).fieldname has the modified value. However, dstest.haschanges comes back as false. dstest.tablename.rows(0).rowstate come back as unmodified Retrieving dstest.getchanges() returns nothing Why wouldn't the program recognize that the dataset has changed? Thanks. Quote
*Experts* Nerseus Posted November 12, 2003 *Experts* Posted November 12, 2003 You must be calling AcceptChanges somewhere in code. -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
djpaz25 Posted November 12, 2003 Author Posted November 12, 2003 I sure hate to diagree with a Super Moderator :-), but I've searched the whole project and don't have AcceptChanges called anywhere. Is it possible that a setting I have for the Dataset or DataAdapter or Connection might be affecting this? My data source is Access, if that makes any difference. Quote
sizer Posted November 12, 2003 Posted November 12, 2003 AcceptChanges returns all row state "flags" to unmodified ( or unchanged ), you could try with: 1) if you are using DataSet myForm.BindingContext(myDSet, MyDataTable.TableName()).EndCurrentEdit() 2) if you are using DataTables myForm.BindingContext(myDataTable()).EndCurrentEdit() Accept changes use ONLY when you already updated your database!! :D Quote Some people are wise and some are other-wise.
djpaz25 Posted November 12, 2003 Author Posted November 12, 2003 Thank you, that was it! I have to do a MyDataSet.TableName(0).EndEdit for it to recognize the changes to the dataset. After doing that, HasChanges comes back as true. I've been pounding my head for a couple of days over that one. Am I the only one who thinks that ADO was simpler than ADO.Net? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.