TLama - that was the 10 point shot, thanks. I've added the amAsync mode some months ago, and I think I didn't realase the all functionality then.
Now I read one more time the help site here, and there is exact answer on my question in the example with 'while' loop.
I'm new on stackoverlflow, how can I repay you, TLama? You saved few my hours :)
Edit 1
Following Frazz sugestion, i'll try to copy some information from the source page linked above.
FireDacs have four modes for commands execute. You can change it in FDQuery1.ResourceOptions.CmdExecMode. You can also set the timeout for executing command in FdQuery1.ResourceOptions.CmdExecTimeout.
The CmdExecModes are:
amBlocking -- The calling thread and GUI are blocked until an action is finished.
amNonBlocking -- The calling thread is blocked until an action is finished. The GUI is not blocked.
amCancelDialog -- The calling thread and GUI are blocked until an action is finished. FireDAC shows a dialog, allowing to cancel an action.
amAsync -- The calling thread and GUI are not blocked. The called method returns immediately.
You can wait while the command is executing, by checking the command state:
FDQuery1.ResourceOptions.CmdExecMode := amAsync;
FDQuery1.Open;
while FDQuery1.Command.State = csExecuting do begin
// do something while query is executing
end;
There is 6 different command states: csInactive, csPrepared, csExecuting, csOpen, csFetching, csAborting.
ResourceOptions.CmdExecMode
property (I guess you've just switched to an asynchronous mode) ? – TLama