Hello,
In my multiuser application i need to check whether a record is being edited by user.
I need this before a other user can start to edit the record.
I whant to show a message that the record is in use by a user.
How can i do this?
Thanks for help
EarlyBird
is record locked?
hello,
To do this you can use the TOraQuery.LockMode and TOraQuery.CheckMode properties, for example:
OraQuery1.LockMode := lmLockImmediate;
OraQuery1.CheckMode := cmException;
in this case users will get an error message when trying to modify a record that was used already.
For more information please see the TOraDataSet.LockMode Property and the TOraDataSet.CheckMode Property topics in the ODAC help.
To do this you can use the TOraQuery.LockMode and TOraQuery.CheckMode properties, for example:
OraQuery1.LockMode := lmLockImmediate;
OraQuery1.CheckMode := cmException;
in this case users will get an error message when trying to modify a record that was used already.
For more information please see the TOraDataSet.LockMode Property and the TOraDataSet.CheckMode Property topics in the ODAC help.
Hi,
thanks for quick response.
I tryed your solution.
It works .
But i need a little more information for the User.
Is there a event fired if i try to edit a locked record?
At the moment i get no message.
I only can´t edit the record.
(Thats good)
If the first user has finished editing the record and then i try to edit the record i get a message:"Record was changed by another user."
Is it possible to get my own message for this.
And last: is it possible to refresh only the changed record automaticliy?
Thanks for help
thanks for quick response.
I tryed your solution.
It works .
But i need a little more information for the User.
Is there a event fired if i try to edit a locked record?
At the moment i get no message.
I only can´t edit the record.
(Thats good)
If the first user has finished editing the record and then i try to edit the record i get a message:"Record was changed by another user."
Is it possible to get my own message for this.
And last: is it possible to refresh only the changed record automaticliy?
Thanks for help
To create your own error message you can use the OnEditError event, for example
procedure TForm1.OraQuery1EditError(DataSet: TDataSet; E: EDatabaseError;
var Action: TDataAction);
begin
ShowMessage('Your error message');
Action:=daAbort;
end;
OraQuery1.RefreshRecord := roBeforeEdit;
procedure TForm1.OraQuery1EditError(DataSet: TDataSet; E: EDatabaseError;
var Action: TDataAction);
begin
ShowMessage('Your error message');
Action:=daAbort;
end;
You can use the RefreshRecord property likeis it possible to refresh only the changed record automaticliy
OraQuery1.RefreshRecord := roBeforeEdit;