Nothing to Update PLEASE HELP

N

Nick Bunton

On a windows form in my application I have a SQL Connect
Object, SQL Data Adaptor and a DataSet. I have some
controls on the form bound to the DataSet and I have
added the follwing code to an Update button.

Dim bm As BindingManagerBase
Dim drv As DataRowView

bm = Me.BindingContext(dsClients, "Clients")
drv = CType(bm.Current, DataViewRow)
drv.EndEdit()

If I now check dsClients.HasChanges it has a value of Not
Modified or something like that. So I cannot get the
dataset to update the underlying tables. Has anyone ever
seen anything like this and maybe give me some advice.

I built a test project with a single form and draged the
table onto the form from the Server Explorer and created
a DataSet and added three text boxes to the form and
added the same code and it works fine, so something must
be wrong with the configuration in my main application.

TIA

Nick
 
C

Cole Shelton

Nick,


It is possible you are getting the wrong BindingContext. Because of the way
you are retrieving the BindingContext below:
bm = Me.BindingContext(dsClients, "Clients")

you had to bind your controls using the notation
Control.DataBindings.Add(dsClients,"Clients.FieldName") as opposed to
DataBindings.Add(Clients,"FieldName"). Both notations are valid, but both
actually get bound to different BindingContext objects. At least this is my
understanding of the situation. I alleviated the problem by always binding
using the first notation I listed.

HTH

Cole

Interworks, Inc
 

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