DBConcurrencyException

  • Thread starter Thread starter Young
  • Start date Start date
Y

Young

I get this exception when I try to update a record that has just been
updated by another user.

Here's the sequence of action.
1) I open the record for edit. Another user does the same.
2) The other user make his/her changes and save the record.
3) After I make my changes and save the record, I get this error.

Is there a way to just overwrite this without throwing an exception?

I used the dataadapter for my update.

I also get the same error when the record has been deleted by another user.
But this is ok.

TIA
Young
 
Young said:
I get this exception when I try to update a record that has just been
updated by another user.

Here's the sequence of action.
1) I open the record for edit. Another user does the same.
2) The other user make his/her changes and save the record.
3) After I make my changes and save the record, I get this error.

Is there a way to just overwrite this without throwing an exception?

I used the dataadapter for my update.

I also get the same error when the record has been deleted by another
user. But this is ok.

TIA
Young


Hi,
This exception comes if the number of updated/inserted/deleted rows was 0.
This can happen if the used update/insert/delete statements were auto
generated by visual studio while the "Use optimistic concurrency" was turned
on (that is the default). In that case the generated statements where clause
contains not only the primary key as selector but all columns too with the
original values. This means that the where clause will be true for the given
record only if the record is the same as it was when it got read into the
dataset. The easiest way to turn this off is to disable the optimistic
concurrency option when auto generating the update/insert/delete statements.
Hope i understood Your problem correctly.

-Zsolt
 
Back
Top