Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Dealing with long query (ADO)

Avatar of gambuz
gambuz asked on
Delphi
22 Comments1 Solution1139 ViewsLast Modified:
Hi,

I am querying remote database server via ODBC using ADO component.

When the query is taking a long time to finish, my application becoming not-responsive.

If you click something there, Windows will response "Not-responding".

Here is my code:

procedure TForm1.Button1Click(Sender: TObject);
begin
  ADOQuery1.CommandTimeout := 3600; // 1 hour
  ADOQuery1.SQL.Clear;
  ADOQuery1.SQL.AddStrings(Memo1.Lines);
  ADOQuery1.Active := TRUE;
  ADOQuery1.ExecSQL;
// The result will be displayed in a DBGrid
end;

My question, How to ignore all events or mouse clicks during this process so the "Not-responding" will not be displayed? But the application window should still be able to MOVE and MINIMIZE / MAXIMIZE ...

Further, I need to add a CANCEL button. How?

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Geert G
Geert GFlag of Belgium imageOracle dba
Commented:
This problem has been solved!
Unlock 1 Answer and 22 Comments.
See Answers