Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cancelling a Query from an ADOConnection

Status
Not open for further replies.
Aug 5, 2002
7
AR
Sorry for my English. I am from Argentina.
I need the user to be able to cancel a large query using a Cancel button. I'm using OLEDB (ADO).

I was read the documentation from Microsoft SDK Documentation, and I intented to use the ADO Objects provided by Delphi. I'm using SQL Server 7.

The objects I try to use where:
TADOCommand with ExecuteOptions [eoAsyncExecute, eoAsyncFetch]

TADOQuery with identical ExecuteOptions

TADODataset with identical ExecuteOptions

Also I tried to assign the "RecordSet" property to a TADOQuery like explains the Delphi Help.

"ADODataSet1.Recordset := ADOCommand1.Execute;", but the answer is: The Recordset is not Open. When I try to open "ADODataSet1.Recordset.Open(parameters...) then I get a Delphi access violation.

What can I do?

I want a proccess similar the environment from "SQL Server Query Analizer". When starts a query, this environment shows a red button to cancel the execution.

It also will be nice to show the progress with a progress bar.

Thanks
Nicolás
 
You need to set the eoAsyncExecute option in the Query component before execution.
To cancel the query, just call the Cancel method of the Query component.
--
Robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top