ADO Connection Object Close and set it equal to nothing 
Author Message
 ADO Connection Object Close and set it equal to nothing

Hi,

I have a question abount ADO connection object Cose:

Dim objConn

Set objConn = Server.CreateObject("ADODB.Connection")

objConn.Open

.......

When Job done, or If Err.number <> 0, Close objConn and Then set it to
nothing.

Are There Any Difference Between

(1) close 1st, then set it =nothing

objConn.Close
set objConn = nothing

or
(2) No close, directly set it =nothing

set objConn = nothing

When (2) above called, directly set objConn=nothing,
Dose this call objConn.Close autoly or not?

Because I saw both sample codes .

Thanks.

Gefei



Fri, 18 Oct 2002 03:00:00 GMT  
 ADO Connection Object Close and set it equal to nothing
objConn.Close
set objConn = nothing

Why not be explicit and not have to guess if the close will done for you?

--
Michael Harris
MVP Scripting

Hi,

I have a question abount ADO connection object Cose:

Dim objConn

Set objConn = Server.CreateObject("ADODB.Connection")

objConn.Open

.......

When Job done, or If Err.number <> 0, Close objConn and Then set it to
nothing.

Are There Any Difference Between

(1) close 1st, then set it =nothing

objConn.Close
set objConn = nothing

or
(2) No close, directly set it =nothing

set objConn = nothing

When (2) above called, directly set objConn=nothing,
Dose this call objConn.Close autoly or not?

Because I saw both sample codes .

Thanks.

Gefei



Fri, 18 Oct 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Setting objects equal to Nothing-- when to do?

2. Does Setting Rs = Nothing closes the connection?

3. Set object to Nothing without Close

4. How to test if an object equals nothing

5. How to test if an object equals nothing

6. Determining If An Object Is Equal To Nothing

7. Testing an Object equal to Nothing

8. ADO.Close or ADO=Nothing?

9. To set = nothing or not to set = nothing...

10. Setting an object variable to Nothing does not destroy the object

11. Help: Setting objects equal (Byval, not Byref)

12. Setting ADO DataControls to a Connection Object

 

 
Powered by phpBB® Forum Software