|
 |
asp_web_howto thread: Database Connection in a Function
Message #1 by "Zaragoza, Enzo" <enzaux@g...> on Thu, 31 Jan 2002 01:41:45 +0800
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_01DE_01C1A9F8.711D6560
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
1.) I have a function that creates the connection:
Function Connect()
.
.
connection process goes here
.
.
End Function
2.) And somewhere on my asp page I called this function:
MyCurrentConn =3D Connect()
3.) At the end I closed the connection with
MyCurrentConn.Closed
Set MyCurrentConn =3D Nothing
Now my question is, if I closed MyCurrentConn does the connection on
my Function Connect() is also closed?
Thanks,
Enzo :)
Message #2 by "Alfredo Yong" <alfredo_yong_linux@h...> on Wed, 30 Jan 2002 12:53:08 -0500
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0059_01C1A98D.11406400
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
As far as I know, variables inside functions are destroyed when you exit
the function. The connection objects lives because it is assigned to
function's return value. But, the referral to the object inside the
function is destroyed when leaving the function.
So, on your question:
if I closed MyCurrentConn does the connection on my Function Connect()
is also closed?
answer is no, because there is no connection inside the function: the
referral in the function is already destroyed!
-Alfredo
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Alfredo_Yong@h...
Freelance Developer - Web systems
Expertise in ASP, DHTML, CSS, jscript, php, SQL & etc.
Zaragoza, Enzo <enzaux@g...> escribi=F3 en el mensaje de noticias
141203@a..._web_howto...
1.) I have a function that creates the connection:
Function Connect()
.
.
connection process goes here
.
.
End Function
2.) And somewhere on my asp page I called this function:
MyCurrentConn =3D Connect()
3.) At the end I closed the connection with
MyCurrentConn.Closed
Set MyCurrentConn =3D Nothing
Now my question is, if I closed MyCurrentConn does the connection
on my Function Connect() is also closed?
Thanks,
Enzo :)
|
|
 |