Hello,
I have so slow query and I tried to execute it in additional thread. The main reason of it - have a possibility to terminate new thread and interrupt query execuion. I created additional TSQLConnection and additional SQLDataSet into the thread. It works fine when query executes successfully, but if i try to close connection (or delete connection, or delete query) while executing query I got an error:
Project raised exception class EAssertionFailed with message 'TOLEDBCommand.Destroy - interfaces not released (2)
The questions are: Is it possible to cancel query execution? How can I do it? Is there another way to execute slow queries and cancel it?
I use RadStudio XE3 (C++ builder) and Devart DBExpress driver for SQL Server 6.3.5
SQLConnection in another thread
Re: SQLConnection in another thread
dbExpress doesn't support such a functionality. As an option, you can use the functionality implemented in the TMSSQL.BreakExec method in SDAC. This method is designed to stop execution of SQL query (as well as from another thread), during its execution. More details about this method are available in our documentation: http://www.devart.com/sdac/docs/index.h ... exec().htm .
Note: a sample of using BreakExec in SDAC is available in the SDACDemo demo project (the source code of the project is for Delphi). SDACDemo is in the "Demos\SDACDemo\" folder relatively to the SDAC demo projects installation path.
Note: a sample of using BreakExec in SDAC is available in the SDACDemo demo project (the source code of the project is for Delphi). SDACDemo is in the "Demos\SDACDemo\" folder relatively to the SDAC demo projects installation path.