Re: Cancelling an ADO Command takes too long



Clayton Arends wrote:



The problem I have is that the cancel operation doesn't appear to be
cancelling the query at all. <snip>

Configuration
------------
I added a TADOConnection to the form and set ConnectOptions to
[coAsyncConnect]. I am using an Oracle 10G connection at my office
(using an Oracle OLEDB driver on my computer).

first question, are you sure Oracle accepts such a command? Just
asking, it's been years since I last worked with that db... :)


if (stExecuting in ADOCommand1.States) then
begin
Memo1.Lines.Add('Cancelling ...');
Memo1.Refresh();
ADOCommand1.Cancel();
Memo1.Lines.Add('Cancelled');
exit;
end;

ADOCommand1.CommandText := Edit1.Text;
ADOCommand1.Execute();

Memo1.Lines.Add("Executing ...");

So here is what I need to know. Have I configured my test correctly
to use asynchronous ADO? Is Cancel() always a blocking operation?
Is Cancel() optionally supported by the database? If the query is a
runaway query should Cancel() eventually come back?


AFAIK Cancel works if the method was called with adAsyncExecute,
adAsyncConnect or adAsyncFetch.

Said this, I'm not sure if regarding updates and depending on if you do
batch updates or not, it would work as you want. Maybe CancelBatch
would be better for that. See also CancelUpdate.

Check these URLs. You will find some examples

http://msdn2.microsoft.com/en-gb/library/ms677516.aspx

http://www.devguru.com/technologies/ado/QuickRef/command_cancel.html

http://www.w3schools.com/ado/met_cancel.asp

Good luck,
--
Best regards :)

Guillem Vicens Meier
Dep. Informatica Green Service S.A.
www.clubgreenoasis.com
--
Contribute to the Indy Docs project: http://docs.indyproject.org
--
In order to contact me remove the -nospam

.



Relevant Pages

  • Re: Parent/Child Relationship to Integrate Data in Reports
    ... I am working on updating my queries but am confident ... On the code to cancel the before update ... Create a query joining the projects and expenses tables. ... Join ProjectID from one table to ParentProjectID in the other. ...
    (microsoft.public.access.reports)
  • Re: How to really cancel an asynchronous Connection.Execute
    ... When you cancel an operation, you're asking the engine to undo what you ... > i'm executing a query asynchronously though an a Connection.Execute ... Connection.CursorLocation, adAsyncExecute, adAsyncFetch, ... > i would then like to be able to Cancel the asynchronously executing query. ...
    (microsoft.public.data.ado)
  • Re: Return to form if query unmatched
    ... Dim MyRecCount As Long ... If it doesn't pop up a message and set Cancel = True. ... record source of that form. ... If it is a sql then you should create a query with that sql, ...
    (microsoft.public.access.queries)
  • Re: Return to form if query unmatched
    ... The final solution I have gone with is using my original query as datasource ... Dim MyRecCount As Long ... If it doesn't pop up a message and set Cancel = True. ...
    (microsoft.public.access.queries)
  • RE: check qry on form close for null entrys
    ... criteria I just put Datebut it still gives me dates from way back. ... If you are using the query builder, don't put Null for each field in the ... show the MsgBox and not restrict the person from closing. ... cancel the close and present the records will Nulls in the form. ...
    (microsoft.public.access.gettingstarted)