Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

  • *Experts*
Posted

You must be calling AcceptChanges somewhere in code.

 

-Nerseus

"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
Posted
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.
Posted

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

Some people are wise and some are other-wise.
Posted

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?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...