views:

81

answers:

3

I am querying a firebird database with a relatively complicated query that takes a while to execute and thought that it would be helpful if the user could get some form of feedback regarding the progress of the query. I intend to display a suitable 'please wait' message on a status bar when the query is started and clear the status bar when the query returns its data.

I am using a TSQLDataSet, TDataSetProvider and TClientDataSet; which event will fire in which component to say that the query has finished and that the data is ready to be displayed?

TIA, No'am

A: 

Since this is UI related (showing a message), I would probably use the TClientDataSet's AfterOpen event.

Bruce McGee
A: 

Check out the BeforeExecute and AfterExecute events of the TClientDataset. They seem to fit what you need.

If you need the UI to be responsive while the query is processing you are either looking at ProcessMessagess or executing the query in a separate thread and using OnTerminate to shuttle the retrieved data to the form.

Marjan Venema
A: 

In retrospect, I'm sorry I posted this question as the answer was remarkably easy and has nothing to do with events. Here is my simple solution.

statusbar1.simpletext:= 'Opening query';
qComplicated.open;
statusbar1.simpletext:= '';

When the query returns with its data, program control moves to the statement after the query open, which clears the statusbar.

I apologise to those who answered.

No'am Newman
It happens to all of us...
Marjan Venema