I have read a lot of forum entries about record locking, but I seem to be the only person experiencing this problem
edAccount is a TQuery.
When I run the following code:
if Mode='Edit' then
try
edAccount.Lock(lrImmediately);
edAccount.RefreshRecord;
edAccount.Edit;
except
on E: EMyError do
if E.ErrorCode=1205 then
begin
MsgDlg('This record is being edited by someone else.'#13'Please try again later.', ['Ok'], cmtWarning);
ModalResult:=mrCancel;
end;
end;
When the record is being edited the program waits the set time (I've set it to 5 secs), then the BDS debugger kicks up the EMySQLException and EMtError
#HY000Lock wait timeout exceeded; try restarting transaction
as expected. However, the program then hangs. Doesn't even get to the error handler.
The TQuery has already been set to FullRefresh = True
I have looked at the Demo and can't see anything wrong.
What have I done wrong? Is there a setting I have missed?