Concurrency is about two people altering the same data at once. If two
pepole can open the record at the same time, change data and then update,
you have a concurrency issue. This is true whether you are changing one
field or many.
The harder the lock you use, the less likely you have concurrency, but the
more likely you make data unavailable. In most apps, I tend to be optimistic
and then handle exceptions on postback.Then again, most apps do not end up
with multiple people editing the same data at the same time. I would still
code a concurrency check, as it is good practice.
--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA
*************************************************
| Think outside the box!
|
*************************************************
"Jonathan Wood" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I posted earlier about the best way to add to a field value, and preventing
>situations where the value could change between the time I read it and the
>time I write the modified value. Some suggestions included using a
>serializable transaction, and using the WHERE statement, which makes sense.
>
> However, while looking into this, I came up with another, simpler syntax,
> that I wonder if it eliminates concurrency issues. It looks like this:
>
> CREATE PROCEDURE dbo.mc_Trainers_AddCredits
> @TrainerId uniqueidentifier,
> @Credits int
> AS
> BEGIN
> SET NOCOUNT ON
> UPDATE mc_Trainers SET Credits=(Credits+@Credits) WHERE UserID=@TrainerId
> RETURN
> END
>
> Can anyone tell me if updating a field in a single UPDATE statement this
> way eliminates concurrency issues?
>
> Thanks.
>
> --
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>