Update Command / Data bound controls Problem

  • Thread starter Thread starter Rob Williams
  • Start date Start date
R

Rob Williams

Greetings All,

I am currently working with VB .NET and having an issue with updating
an ACCESS DB via ADO.NET.. Any help would be great.
I am using the data object components. (oledbconn, dataAdapter, &
Dataset).. The dataadapter fills the dataset just fine. The data is
bound to several textboxes. My navigation controls work just fine as
well. However whenever I make a change to a textbox field and hit
update the changes are not made to the DB. Ive included a msgbox to
say yeah or nah to changes. It always says false. I am using the
generated UPDATE command. What am I doing wrong?


Generic Code Snippett

sub : LOADDB

da.fill(ds,"Users")

end sub


sub UpdateDB

messagebox.show(ds.haschanges)

da.update(ds)

end sub

Thanks
Rob
 
Had the same problem recently, still learning myself so would be interested
in any ideas, but I resolved as follows.

The LoadDB function is running when the code behind is initialized right?
When you hit the Update button, its re-initializing the DataSet from the
DataSource before the UpdateDB code is run, so in effect, you've got no
changes. However, your values from the form are passed back to the server
so you can update the DataSet from those (ds("dbfield") = formField.text).

It seems to me that there should be a way to pass the changed DataSet back
to the server but I haven't worked that out yet. Problem is that when I try
to check the values in the DataSet before the init code is run, I get Object
is Nothing errors. Since the Form Fields are passed back in the post back,
I would assume the DS would be too, but I don't know how to reference it?
 
Back
Top