I read this article: http://www.utteraccess.com/wiki/Recordsets_for_Beginners, and it says that it's important for me to close and destroy RS's like this:
rs.close
Set rs = Nothing
and if I don't, some bugs may happen.
- What kind of bugs?
- What does
rs.close
means? Does it mean that the connection to the database is kept open for as long as thers
isn't closed?
rs.close
cleans up the resources that are used internally, however because ASP is a single process that doesn't have any GC theSet rs = Nothing
aids in the clean up.It de-references your objects, without it you'll have a memory leak. nice isn't it?
What T McKeown says is absolutely right
Depending the type of
ADODB.Recordset
you are returning you can end up with some unnecessary overheads. The purpose ofCall rs.Close()
is remove these overheads that for most data retrieval purposes are not required.Take this example, with the connection defined at the start of the page it lives for the entire life of the page.
Over the years I found that working with arrays to display data is far more efficient and saves on the overheads of the ADODB objects.
For more infomation on working with data in Arrays see this answer to another question, the examples given contain examples of iterating through your data using an Array.