Query CommandTimeOut problems

Hello all,

I thought this was an easy fix, but no luck.  I have a big query that takes about 2 to 3 minutes to run.  It times out after about 20 seconds, so I added the following line to the query:

    qryThis.CommandTimeout:=1200;

But it still times out after 20 seconds or so.  I specify each column in my SQL Select.

Any ideas?

Thank you!

Dave
0
David
3/6/2015 11:20:26 PM
embarcadero.delphi.ado 597 articles. 1 followers. Follow

4 Replies
802 Views

Similar Articles

[PageSpeed] 26

Dave,

On Fri, 06 Mar 2015 23:20:26 -0000, David Cox  wrote:

> I thought this was an easy fix, but no luck.  I have a big query that  
> takes about 2 to 3 minutes to run.  It times out after about 20 seconds,  
> so I added the following line to the query:
>
>     qryThis.CommandTimeout:=1200;
>
> But it still times out after 20 seconds or so.  I specify each column in  
> my SQL Select.

You don't say which components you are using, but ADO historically had a
problem with AdoQuery where you had to set the CommandTimeout in the
AdoConnection as well as the AdoQuery

-- 
Paul
0
Paul
3/9/2015 2:36:43 PM
Dave,

On Fri, 06 Mar 2015 23:20:26 -0000, David Cox  wrote:

> I thought this was an easy fix, but no luck.  I have a big query that  
> takes about 2 to 3 minutes to run.  It times out after about 20 seconds,  
> so I added the following line to the query:
>
>     qryThis.CommandTimeout:=1200;
>
> But it still times out after 20 seconds or so.  I specify each column in  
> my SQL Select.

You don't say which components you are using, but historically ADO had a
problem with AdoQuery where you had to set the CommandTimeout in the
AdoConnection as well as the AdoQuery

-- 
Paul
0
Paul
3/9/2015 2:36:52 PM
Hi Paul,

You have answered my question!  I am indeed using ADOQuery.  I will try setting both parameters.

Thanks!

Dave
0
David
3/9/2015 6:00:26 PM
Dave,

On Mon, 09 Mar 2015 18:00:26 -0000, David Cox  wrote:

> You have answered my question!  I am indeed using ADOQuery.  I will try  
> setting both parameters.

My suggestion was from memory while sitting in an airline departure lounge.

While I hope that the fix will work, now that I'm back at base I see I had  
misremembered what was broken and there were a few more hoops I had to  
jump through..

Some of my source comments referring to AdoConnection...

   // Apparently this is "broken" in D5/D6..
   fInternal_AdoConnection.CommandTimeout := aCommandTimeout ;

and to AdoQuery...

   // Apparently this is "broken" in D5/D6..
   fInternal_AdoQuery.CommandTimeout := aCommandTimeout ;

   // .. but the method in "tAdoDataSet" is supposed to work
   tAdoDataSet(fInternal_AdoQuery).CommandTimeOut := aCommandTimeOut ;


I can add this code because I'm instantiating all my query components by  
hand - my PjsAdoConnection and PjsAdoQuery are replacement container  
classes which each has its own "fInternal_AdoConnection" /  
"fInternal_AdoQuery" field - and every descendant query type I create will  
thus automatically include this fixup code.

If you've dropped components onto a form, then it might be a little harder  
for you to get to the internals - and you'll have to remember to do it for  
every query

One more thing I would suggest is that you set the timeouts immediately  
you create the connection/query - and leave it set - rather than tweak it  
for each execution

-- 
Paul
0
Paul
3/9/2015 6:32:11 PM
Reply: