Re: ADODB Connection Question

From: J. Baute (WUPYRDEDAWJD_at_spammotel.com)
Date: 04/23/04


Date: Fri, 23 Apr 2004 09:58:47 +0200


The first is the best imo, because that way you will only be opening 1
connection per page. I have the habbit of passing the ADO connections as a
parameter to objects or functions that need one, instead of having those
create their own every time.

I'd avoid always opening the connection in the include file though, because
in some cases you might not need it at all, in which case setting up a DB
connection is a waste of resources (although with ADO connection pooling
this is probably very minimal).

"Astra" <info@NoEmail.com> wrote in message
news:e$WwVPFKEHA.1388@TK2MSFTNGP09.phx.gbl...
> Hi All
>
> Just IYHO, which is better:
>
> METHOD 1
> =========
> Creating the ADODB connection obejct at the beginning of an ASP page in an
> include file.
>
> Functions containing the requirement to create any ADODB commands or
> recorset ojects to do a query and then close/drop the same objects in an
> include file.
>
> Drop/close the ADODB connection obejct at the end of an ASP page in an
> include file.
>
> METHOD 2
> =========
> Encapsulate the ADODB connection within each of the functions so that when
> they are executed the connection, retrieval and drop is basically all in
> about 3 lines of code.
>
> As far as I can see Method 1 has the bonus of only creating 1 connection
> object and then allowing the commands and recordsets to feed off this, but
> then again the connection is open for the time it takes the full page to
be
> generated.
>
> As far as I can see for Method 2 it does keep the connection open to a
> minimum, but if I have 3 or 4 queries that need to be run then it means 3
or
> 4 connections have to be created as well as the commands and recordsets.
>
> I favour Method 1, but what do you think? Is there a Method 3??
>
> Thanks
>
> Robbie
>
>



Relevant Pages

  • ADODB Connection Question
    ... Creating the ADODB connection obejct at the beginning of an ASP page in an ...
    (microsoft.public.inetserver.asp.db)
  • Passing a FrontPage database result to a variable vs adodb.connect
    ... It is more complicated than just this, because I need to pass this to a flash ... On one webpage I used an adodb connection to find a result from a local ... Is there a way I can use this FrontPage ASP component to pass a variable to ...
    (microsoft.public.frontpage.programming)
  • Re: ADODB Connection Question
    ... connection until just before the first time I need it. ... connection and set its connection string in the include file. ... > Creating the ADODB connection obejct at the beginning of an ASP page ... This email account is my spam trap so I ...
    (microsoft.public.inetserver.asp.db)
  • Re: ADODB Connection Question
    ... I'd avoid always opening the connection in the include file though, ... > Creating the ADODB connection obejct at the beginning of an ASP page in an ... > object and then allowing the commands and recordsets to feed off this, ...
    (microsoft.public.inetserver.asp.db)
  • Re: DDE Access to Word using mde
    ... but Word opens just fine. ... to an Access 2002/3 .mde using DDE, the connection is fine. ... By the way there are no other users(except the current opening of the ...
    (microsoft.public.word.mailmerge.fields)