Concurrency violation

B

Bill S.

Can anybody tell me what is a concurrency violation, and why would one
occur?

Thanks
 
W

William \(Bill\) Vaughn

When an action command (update, insert or delete) fails, it's reported as a
"concurrency failure". This simply means that the action command did not
affect 1 row. If your action command affects 0 rows, it could mean that the
SQL logic did not find the row to change or it had already been changed. If
your action command affects more than one row, you can also get a
concurrency violation.

hth
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
A

Anubhav Mishra

There is one apple left, I and you get the data, see its available and buy
one, you buy first, then I buy, if in my code I have not handled concurrency
then thats what we call concurrency violation, so both our transactions are
done, and there is only one apple,

Ideally my code should have checked that the record was not updated by any
one else before updating with my changes, one way to check the
lastupdatedtimestamp or the records value that I had received has not
changed.

Anubhav Mishra
 
S

Sahil Malik

Okay say you and I like the same girl.

You take her out for a date, you like her a lot, but she doesn't like you so
much.
Then she goes out for a date with me, I propose and she accepts, we marry.

Meanwhile you have a massive crush on her, you buy an expensive ring, and
propose - but the row (her finger) is already updated with my ring.

That's a concurrency violation.

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top