P
Phil Daley
I am controlling concurrency in my database records via a datetime column,
with a stored procedure such as:
UPDATE .......WHERE myid=@myid AND lastmodified=@lastmodified
SELECT @lastmodified=lastmodified ........WHERE myid=@myid
In this way, after any update, I get the new lastmodified column returned so
that if the user saves the data again everything still works. This works as
expected.
However, if the update fails, I get the expected DBConcurrencyException, but
the data in the Row property does not contain the new datetime value, but
the original datetime. I can get at the new datetime by trapping the
RowUpdated event and examining Command.Parameters, but as I am using a
generic routine for all my updates I cannot use this method as different
tables may have different datetime column names and I cannot pass the column
name to the event.
Anyone any ideas?
with a stored procedure such as:
UPDATE .......WHERE myid=@myid AND lastmodified=@lastmodified
SELECT @lastmodified=lastmodified ........WHERE myid=@myid
In this way, after any update, I get the new lastmodified column returned so
that if the user saves the data again everything still works. This works as
expected.
However, if the update fails, I get the expected DBConcurrencyException, but
the data in the Row property does not contain the new datetime value, but
the original datetime. I can get at the new datetime by trapping the
RowUpdated event and examining Command.Parameters, but as I am using a
generic routine for all my updates I cannot use this method as different
tables may have different datetime column names and I cannot pass the column
name to the event.
Anyone any ideas?