Page 1 of 1

Possible to cancel query execution?

Posted: Sat 16 Jul 2005 06:41
by Ray Mond
Is is possible to cancel an executing query, like Query Analyzer does? Thanks.


Ray Mond

Posted: Mon 18 Jul 2005 06:09
by Ikar
Please see TCustomMSDataSet.BreakExec description

Posted: Mon 18 Jul 2005 15:04
by Ray Mond
How do I go about using this method? Do I create one TMSConnection, but 2 different TMSQuery components in 2 different threads, both connected to the same TMSConnection, where one runs the query and the other cancels it whenever needed?

Ray Mond

Posted: Wed 20 Jul 2005 11:37
by Ikar
Not, you must use at the single thread own TMSConnection and TMSQuery. If necessary, break an execution, from another thread call BreakExec of TMSQuery. It is a seldom case when with the single component (TMSQuery) can work from several threads at the same time.

Posted: Thu 21 Jul 2005 02:07
by Ray Mond
So it works like this?

I have a GUI app. To run a query, I create a thread with it's own TMSConnection and TMSQuery. When I want to cancel the query, I call the TMSQuery's BreakExec from my main form?

Ray Mond

Posted: Thu 21 Jul 2005 06:13
by Ikar
Yes, you are absolutely right

Posted: Mon 15 May 2006 05:44
by com
Assuming that I can cancel executing query from main thread with BerakExec. This mean I must run query in separate thread. But now I want to have both possibilities: to cancel query, running in the separate thread and to display recordset in a grid in main thread.

The question is: how can I put recordset in main thread?

With ADO I can handle it just assigning MainThreadADODataSet.Recordset = InterruptableThreadADODataSet.Recordset;
on thread terminate.
But with SDAC I have no idea.

Posted: Wed 17 May 2006 12:18
by Jackson
SDAC doesn't support such functionality.