Forum Moderators: open
Sometimes, due to the flow of the logic on the page, there are SQL commands that are stored in a recordset, and sometimes there are just SQL commands that are executed without creating a recordset.
The problem is that I like to close and destoy the recordset at the bottom of the page using a command like:
rsInfo.Close
rsInfo = Nothing
This returns an error if the recordset was never used within the page.
It doesn't seem right to close the recordset after each use, but that is the only way I can imagine only trying to close it when it has been used.
Does this make sense? Maybe I shouldn't worry about closing it. Any help is appreciated.
Typically I close the recordset and the database connection at the end of the page. If the page sometimes uses the recordset, and sometimes it doesn't what do I do with it?
What I'm looking for is something like:
If rsExists(rsInfo) Then
rsInfo.Close
rsInfo = Nothing
End If
Otherwise I run the risk of trying to close it when it's not been used. Make sense?
I have never heard that one before, can you expand a little. How does this that "hit" compare to the hit imposed by FOUR evaluations in the other example?
If it is expensive performance wise then I'd be intersted to know how expensive. The only thing IMO to watch out for with on error resume next, is that its not used at global level.