What is the importance of closing a record set and connection upon completing a set of commands in asp?

Hi Experts,

Is it necessary to do the following after a set of commands has been read?


rs.Close
set rs=nothing


conn.close
set conn=nothing
LVL 1
indyngAsked:
Who is Participating?
 
TimCotteeConnect With a Mentor Head of Software ServicesCommented:
Hi indyng,

Yes!

If you do not close these objects and set them to nothing there is no guarantee that the resources used by the objects will be released properly when they are implicitly closed.

As with all objects, you should ensure that you manage the whole lifecycle of the object, if you create it and instantiate it then you should close it and release it when you are finished with it. Now of course that period of time is variable and depends entirely on your situation. Either way it is a good rule of thumb that you should close and release everything you open.

Tim Cottee
Brainbench MVP for Visual Basic
http://www.brainbench.com
0
 
indyngAuthor Commented:
Thanks Tim
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.