How to menage concurrency with timestamp (C#)
-
hi everybody, i want to know how to menage the optimistic cuncurrency using timestamp. i've already added a column for every table (timestamp type). how i can modify the Update command to use it? (im using C# 2005) Thank you in advance Enrico VentoEngine corp. Program your life ^^
-
hi everybody, i want to know how to menage the optimistic cuncurrency using timestamp. i've already added a column for every table (timestamp type). how i can modify the Update command to use it? (im using C# 2005) Thank you in advance Enrico VentoEngine corp. Program your life ^^
During your SELECT statement you can get the timestamp and keep it for updating purpose later. I usually save the timestamp as long variable. On your update statement, pass the timestamp as a parameter along with the rest that you need to make sure you update the correct version of the data, e.g.
UPDATE customer SET [name] = @newname WHERE [id] = @id AND [rowversion] = @timestamp <-- timestamp value
Edbert Sydney, Australia "A day without sunshine is like, you know, night."