L.A. Jones,
This is definitely a possibility. This is why you use something like a
timestamp field or a date time field on your column. When you select the
data, you get the timestamp field.
Then, when you update your query, you update the row that corresponds to
the row that has the values. So, if you are using a primary key, you would
say "where key = <key>" to indicate the row to update. You would expand
that to say "where key = <keyand timestamp = <timestamp>". If no rows are
updated, then you know that someone beat you to it.
Here is a page in the MSDN documentation which talks about concurrency
in database operations:
http://msdn2.microsoft.com/en-us/library/aa0416cz.aspx
And here is another that explores using a primary key along with a
timestamp:
http://www.eggheadcafe.com/articles/20050719.asp
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Dave" <Da**@discussions.microsoft.comwrote in message
news:80**********************************@microsof t.com...
>I have have database that I'd like to update a numerical field (field1).
However, I make changes to the dataset and then call the
dataadapter.Update
function.
Here's the sequence
1. Get value in field1 (from dataset1)
2. field1 = field1 - variable1
3. Call dataadapter.Update(dataset1)
I am wondering if the possibility exist that if 2 users are updating
field1
at the same time, then it might lead inconsistent data. If this is so, how
can I avoid this problem.
--
L. A. Jones