Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Re: CommandTimeout


Message #1 by "Ken Schaefer" <ken@a...> on Tue, 18 Jun 2002 11:11:39 +1000
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Paul R Stearns" <pauls@c...>
Subject: [asp_web_howto] CommandTimeout


: Is there a way that I can use a command timeout with the recordset object?
:
: For example;
:
: set RsSelect = Server.CreateObject("ADODB.Recordset")
:
: RsSelect.CommandTimeout = 0
:
: gives me an error "Object doesn't support this property or method".
:
: I have quite a number of pages where adding a command timeout value is
needed an
: they all use the Recordset object. It appears that I can use this on a
: ADODB.Connection object, but it would require recoding a number of asp
pages.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

These are the questions I would be asking:

a) Why do you need to increase the CommandTimeout? That shouldn't be
necessary for a normal web app project

b) Assuming that you do genuinely need to increase this value, why aren't
you encapsulating the code to instantiate and return a connection object
inside a routine? That way you'd only have to make *1* change, and
everything would be updated:

<%
' Store the following in an include file
Function OpenDBConn( _
    ByVal strDBConnString _
    )

    Dim objConn

    Set objConn = Server.CreateObject("ADODB.Connection")
    ' Add the next line to your routine
    objConn.CommandTimeout = 60
    objConn.Open strDBConnString

    Set OpenDBConn = objConn

End Function
'
'
' Open Connection in your code
Set objConn = OpenDBConn(Application("DatabaseConnString"))
%>


Message #2 by "Ken Schaefer" <ken@a...> on Tue, 18 Jun 2002 13:32:58 +1000
Hi there,

Reading documentation indicates that CommandTimeout is a property of the
Connection and Command objects only:
http://msdn.microsoft.com/library/?url=/library/en-us/ado270/htm/mdprocomman
dtimeout.asp
I don't think there is any way to set it using a recordset object.

That said, I assume that you have:

<%
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open

Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open sp_Source, objConn,,,adCmdStoredProc
%>

in your pages. Why can't you use one of the freeware tools out there to do a
find-n-replace on the first two lines, and insert a line setting the
CommandTimeout property?

(or change it to call a routine, and set the CommandTimeout in the routine).

What do you have at the moment? Surely, you're still going to have to change
things all over the place if you're using Recordset objects only?

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Paul Stearns" <pauls@c...>
Subject: [asp_web_howto] Re: CommandTimeout


: Ken:
:
: The answer to question 1 is yes I really do need to change the
commandtimeout,
: because I am creating reports which have more than a hundred rows of
summary data
: distilled from tbles which contain millions of records. In some cases
where I am
: doing thematic mapping I am creating temporary tables with in excess of a
thousand
: rows.
:
: I have an application which is written using the recordset methodology
included in
: many asp pages. Should I need to change all of thesepages to use a
different
: approah, I will certainly use an easily maintainable approach.
:
: Which brings me back to the original question, before I weed through over
100 asp
: pages and change the approach that currently works does anyone know how
to use a
: command timeout with the recordset object?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Message #3 by Paul R Stearns <pauls@c...> on Mon, 17 Jun 2002 15:33:20 -0400
Is there a way that I can use a command timeout with the recordset object?

For example;

set RsSelect = Server.CreateObject("ADODB.Recordset")

RsSelect.CommandTimeout = 0

gives me an error "Object doesn't support this property or method".

I have quite a number of pages where adding a command timeout value is needed an
they all use the Recordset object. It appears that I can use this on a
ADODB.Connection object, but it would require recoding a number of asp pages.

Message #4 by Paul Stearns <pauls@c...> on Mon, 17 Jun 2002 22:47:26 -0400
Ken:

The answer to question 1 is yes I really do need to change the commandtimeout,
because I am creating reports which have more than a hundred rows of summary data
distilled from tbles which contain millions of records. In some cases where I am
doing thematic mapping I am creating temporary tables with in excess of a thousand
rows.

I have an application which is written using the recordset methodology included in
many asp pages. Should I need to change all of thesepages to use a different
approah, I will certainly use an easily maintainable approach.

Which brings me back to the original question, before I weed through over 100 asp
pages and change the approach that currently works does anyone know how  to use a
command timeout with the recordset object?

Paul

Ken Schaefer wrote:

> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> From: "Paul R Stearns" <pauls@c...>
> Subject: [asp_web_howto] CommandTimeout
>
> : Is there a way that I can use a command timeout with the recordset object?
> :
> : For example;
> :
> : set RsSelect = Server.CreateObject("ADODB.Recordset")
> :
> : RsSelect.CommandTimeout = 0
> :
> : gives me an error "Object doesn't support this property or method".
> :
> : I have quite a number of pages where adding a command timeout value is
> needed an
> : they all use the Recordset object. It appears that I can use this on a
> : ADODB.Connection object, but it would require recoding a number of asp
> pages.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> These are the questions I would be asking:
>
> a) Why do you need to increase the CommandTimeout? That shouldn't be
> necessary for a normal web app project
>
> b) Assuming that you do genuinely need to increase this value, why aren't
> you encapsulating the code to instantiate and return a connection object
> inside a routine? That way you'd only have to make *1* change, and
> everything would be updated:
>
> <%
> ' Store the following in an include file
> Function OpenDBConn( _
>     ByVal strDBConnString _
>     )
>
>     Dim objConn
>
>     Set objConn = Server.CreateObject("ADODB.Connection")
>     ' Add the next line to your routine
>     objConn.CommandTimeout = 60
>     objConn.Open strDBConnString
>
>     Set OpenDBConn = objConn
>
> End Function
> '
> '
> ' Open Connection in your code
> Set objConn = OpenDBConn(Application("DatabaseConnString"))
> %>
>
> ---
>
> Improve your web design skills with these new books from Glasshaus.
>
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> r-20
> Constructing Accessible Web Sites
> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
> http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> r-20


  Return to Index