Do you know how to collect the value in a TimeStamp field?
My intention is to use this value to check whether another user has updated the field whilst I have been reviewing it - and then I go to make my update.
My TimeStamp field is called Stamp.
I could not find a Delphi type to copy it into directly, so I tried to convert it to a DateTime with this code:
myDateTime:=SQLTimeStampToDateTime(MSQuery1.FieldByName('Stamp').AsSQLTimeStamp);
This returns the error: "Cannot access field Stamp as type SQLTimeStamp".
Any help would be appreciated.
Thanks,
Steve.
TimeStamp
CheckRowVersion
I have read your help but cannot understand it.
I want to implement Optimistic locking.
If I set MsQuery1.Options.CheckRowVersion:=True
Also have a TimeStamp and ID (autoinc) fields in the table.
How do I actually check whether the row has been updated by another user?
Do you have any sample code to illustrate this operation, so that I can give the user a choice of whether to abandon his update or overwrite the update made by the other user?
Thanks for your help.
Steve.
I want to implement Optimistic locking.
If I set MsQuery1.Options.CheckRowVersion:=True
Also have a TimeStamp and ID (autoinc) fields in the table.
How do I actually check whether the row has been updated by another user?
Do you have any sample code to illustrate this operation, so that I can give the user a choice of whether to abandon his update or overwrite the update made by the other user?
Thanks for your help.
Steve.
Optimistic locking - once again
I set CheckRowVersion to True in your example SdacDemo-> CachedUpdates, I added a TimeStamp field to the dbo.emp table, I opened 2 copies of sdacDemo and I was editing the same record in the same time. Nothing happend.
In that case should I get any error message or there is another way to catch this event ?
I use Sdac 4.30, Delphi 5.
Thanks for your help.
ZS
In that case should I get any error message or there is another way to catch this event ?
I use Sdac 4.30, Delphi 5.
Thanks for your help.
ZS
You are answered in this thread: http://crlab.com/forums/viewtopic.php?p=32617#32617