what to actually do on dbconcurrency exception?

  • Thread starter Thread starter jarb
  • Start date Start date
J

jarb

..Net v1.1

If I get a dbconcurrency exception during a DataAdapter.Update() call what
should I actually do to continue the update? I would like to give the user 2
options. Cancel the update, and get the server's most recent values overwriting
local changes OR continue the update and overwrite the server's values.

I'm assuming I can do this all with the same DataAdapter and same Update/Delete
commands that i already have right? So for my big WHERE clause style of
concurrency checking.. in order to get it to go thru I need the WHERE clause
parameters to be the most recent values from the server. How do I stuff those
most recent values into the row.value.Original section of the rows?

Sorry I haven't seen this anywhere, must have missed something.

thx
 
Jarb,

There is not one solution, you can make it advanced or just use a rollback.

Have for that a look on MSDN transactions, there is an old version and a new
one.
The old one is in the SQLConnection the other one is a seperate class.

http://msdn2.microsoft.com/en-us/library/86773566.aspx

You can as well let the dataadapter ignore those concurrency errors (and all
others) and investigate the rowerrors from the datarows and take than your
actions.

I hope this helps,

Cor
 
Back
Top