|
 |
asp_database_setup thread: connectionstring
Message #1 by "John Sen Yong" <yjohns@t...> on Mon, 26 Mar 2001 23:40:17 +0800
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0016_01C0B64E.1D2A7540
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
some people say declaring connectionstring in the application global
variable is better than having an include file....becos he said include
file u have to include it to every asp that need a connection
but in my opinion, declaring the connection in the application global
variable u got to declare it in every asp file also...
for example...
u got to type this objConn.open=3DApplication("CONNECTIONSTRING") in
every page of asp...
but some time ago in aspdatabase, i heard some1 said u only declare
once..
so which is correct?
if i m not, could some1 give some advice?
thanks...
Message #2 by "Ken Schaefer" <ken@a...> on Tue, 27 Mar 2001 18:04:25 +1000
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: some people say declaring connectionstring in the application global
: variable is better than having an include file....becos he said include
: file u have to include it to every asp that need a connection
: but in my opinion, declaring the connection in the application global
: variable u got to declare it in every asp file also...
: for example...
: u got to type this objConn.open=3DApplication("CONNECTIONSTRING") in
: every page of asp...
: but some time ago in aspdatabase, i heard some1 said u only declare
: once..
: so which is correct?
: if i m not, could some1 give some advice?
: thanks...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please turn off the HTML mail.
Also, punctuation doesn't hurt - full stops, commas, sentence capitalisation
etc.
You have two choices:
a) Declare an application variable and store the connection string there
b) Create an include file, store the connection string in a local variable
in the include file, and include the file on every page.
IIS will cache the "compiled" output of each page (until it's buffer is
full), so using an include file probably isn't any slower than using an
Application variable, since the include process (physically reading the
include file from the hard disk) is only done once.
That said you still need to read the include file, and you cached pages end
up being that much bigger.
Cheers
Ken
|
|
 |