Two Datasets on a single form

G

Gary Shell

Sorry for the crosspost, I initially posted this to the
microsoft.public.dotnet.languages.vb.data
group, but it never showed up there. (Is that newsgroup still active???)

I have two datasets declared on a single form. The form is instantiated by
another form which passes two parameters to the form. These parameters are
used to select the data for each of the two datasets.

The first dataset loads fine as does the second one. If changes are made to
the controls bound to the first data set the binding context correctly
reports that the dataset has modifications and my code updates the database
with the info from the dataset.

The second dataset however ALWAYS reports that the dataset has ADDITIONS not
modifications. I traced back through the code to find that this actually
occurs IMMEDIATELY after the fill of the dataset from the sql adapter. Odd.
Thinking maybe it had something to do with the combo boxes that this
particular dataset was bound to, I removed all the databinding for this
dataset. Yet the binding context still sets the
HasChanges(DataRowState.Added) flag as true right after the fill. To get
around the issue I do an AcceptChanges right after the fill and
re-established the databindings. Now when I change data in one of the bound
controls, the binding context reports that I have modifications NOT
additions.

Anyone know why a newly filled dataset should immediately set the
HasChanges(DataRowState.Added) flag to true?

Gary Shell
 
G

Gary Shell

I am not explicitly setting it. (Didn't even realize it exists!) Does the
VB.NET IDE set this by automatically? Both datasets on the form were
created using the IDE.

Just did a text search and it WAS set to false for this dataset. But for
the life of me I don't know why or how!!!
Me.sqladapterScenarioLoc.AcceptChangesDuringFill = False


Is there some option in the IDE when configuring a SQL adapter that does
this?

Thanks!!!!!!!!!!!!!!

Gary
 

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