Locking and display message
Posted: Wed 08 Nov 2006 13:47
Hi,
I've readed many threads on the form but can't figure out the right
way how to handle. The LockDemo shows a little bit, but not all.
I use InnoDB tables and now i want to prevent users from editing
the same record when it's in use with a ohter user.
I use now MyQuery.BeforeEdit this code :
At this point i also would like to check if the record is locked and
display the use a mesage, so thought...let's try this :
When i start a second instance of the apps on the same
computer and would like to change the same record, it's
not possible, but my apps hangs and doesn't show
the message.
How to solve this problem are there some good
examples because i can't find them....thanks
Greetz
Peter
I've readed many threads on the form but can't figure out the right
way how to handle. The LockDemo shows a little bit, but not all.
I use InnoDB tables and now i want to prevent users from editing
the same record when it's in use with a ohter user.
I use now MyQuery.BeforeEdit this code :
Code: Select all
if not dmTables.qry_action.Connection.InTransaction then begin
dmTables.qry_action.Connection.StartTransaction;
dmTables.qry_action.Lock(lrImmediately);
end;display the use a mesage, so thought...let's try this :
Code: Select all
if dmTables.qry_action.Connection.InTransaction then begin
Application.MessageBox('Record in use/can't changed !', 'Record in use', MB_OK+MB_ICONASTERISK+MB_DEFBUTTON1+MB_APPLMODAL);
dmTables.qry_action.Connection.Rollback;
Abort;
end;computer and would like to change the same record, it's
not possible, but my apps hangs and doesn't show
the message.
How to solve this problem are there some good
examples because i can't find them....thanks
Greetz
Peter