If I was charged a nickel for every time I wrote:
Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = ...
objConn.Open
Set objRS = objConn.Execute("...")
And was given a nickel for every time I wrote:
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
I would be loosing money... a lot of money! :) In fact, I think the vast majority of ASP developers would be in the hole. While ASP should automatically close and free up all object instantiations, it is always a good idea to explicitly close and free up object references yourself. Another good reason to do this, is because when using connection pooling, you want to close and free your ADO objects as soon as possible, and if you do it explicitly once you're done with the ADO object, it dumps the connection back into the pool sooner than if you wait until the page terminates and let the terminating page implicitly close and free the ADO object.
So, take my advice: if you ever do a Set someVar = ..., be sure
you follow it up with a Set someVar = Nothing once you are through
using someVar!
Read a related article...




