PC Review


Reply
Thread Tools Rate Thread

DBConcurrencyException

 
 
Young
Guest
Posts: n/a
 
      2nd Jun 2009
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


 
Reply With Quote
 
 
 
 
miher
Guest
Posts: n/a
 
      3rd Jun 2009


"Young" <(E-Mail Removed)> az alábbiakat írta a következő üzenetben
news:4a24e252$(E-Mail Removed)...
> 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


 
Reply With Quote
 
Young
Guest
Posts: n/a
 
      5th Jun 2009
Thanks.

Can you please tell me how I can turn off optimistic concurrency?

Young

"miher" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>
>
> "Young" <(E-Mail Removed)> az alábbiakat írta a következő üzenetben
> news:4a24e252$(E-Mail Removed)...
>> 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
>
>



 
Reply With Quote
 
miher
Guest
Posts: n/a
 
      10th Jun 2009
Hi,
Check the advanced settings while generating the dataset.
-Zsolt

"Young" <(E-Mail Removed)> az alábbiakat írta a következo üzenetben
news:(E-Mail Removed)...
> Thanks.
>
> Can you please tell me how I can turn off optimistic concurrency?
>
> Young
>
> "miher" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>>
>>
>> "Young" <(E-Mail Removed)> az alábbiakat írta a következő üzenetben
>> news:4a24e252$(E-Mail Removed)...
>>> 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
>>
>>




 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dbconcurrencyexception =?Utf-8?B?U2FsaW0=?= Microsoft ADO .NET 1 6th Jun 2005 02:36 PM
DBConcurrencyException richard Microsoft ADO .NET 5 30th Sep 2004 06:44 PM
DBConcurrencyException Hans Michael Rupp Microsoft ADO .NET 1 10th Jun 2004 02:56 AM
DBConcurrencyException 2G Microsoft C# .NET 2 20th May 2004 07:05 AM
Never get a DBConcurrencyException =?Utf-8?B?Qm9yZWNhc3Q=?= Microsoft ADO .NET 1 5th Apr 2004 04:17 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:02 AM.