need advice on keeping ds table & db tables in synch, in a ws (if possible)

  • Thread starter Thread starter Jason Shohet
  • Start date Start date
J

Jason Shohet

We have an app that queries 5 tables into a dataset. Now, lets say 1 of
those tables is about to change due to user input on a webpage. Right now,
we are manually updating the db with an update command (execute non-query)
in a web service. But now, we're not sure how to now update the table in
the ds. My thinking is requery that 1 table, grab my dataset from the
session & do sda.Fill(myDS, "tblEmployee") which will keep my existing ds,
just replacing tblEmployee.

But perhaps there's a better way to do this. It would be nice if I could
just update the dataset value from the datagrid (although that seems like a
pain to do) and just do myDS.Save( ) and it automatically know which
table(s) to update in the db so the dataset & the database are in synch.

The other request I would have is, can the above be done in a web service?
(A couple years ago I played around with dropping a dataset on a page and
strong-typing it but I didn't like that it was done on a page, and not a ws.
And if the db table structure changed the entire construct broke, which was
a pain in the neck)

Thanks for any best-of-breed advice :)
 
Hi Jason,

If you are updating database from datatable why do you need to refresh
datatable in first place?
You need to retrieve the autoinc field or something like that?
If this is the case, you might use Fill method with properly set commands
and the dataadapter will refresh the datatable for you.
 
Back
Top