Click to See Complete Forum and Search --> : What happens when you don't close a recordset or connection?


heavenly_blue
02-01-2005, 06:27 PM
When using things like this...

Set conWhatever = Server.CreateObject("ADODB.Connection")
Set rstWhatever = Server.CreateObject("ADODB.RecordSet")

...what kind of bad things actually happen when they are not closed in the script?

Do I need to close them AND set them = Nothing, or does it even matter?

buntine
02-01-2005, 08:34 PM
By convention, its best to do both. The objects will take up space in memory after you are finished with them. Your Web Site will run slowly if too much memory is consumed.

And afterall, there is no use having objects lying around taking up space if you dont need them again.

Regards.