Start Updating sql server dao recordsets

Updating sql server dao recordsets

The object resources will be released as soon as this happens.

SYMPTOMS: A Microsoft Access database has begun to bloat (or grow rapidly in size) after you implement Data Access Objects (DAO) to open a recordset.

CAUSE: If you do not release a recordset's memory each time that you loop through the recordset code, DAO may recompile, using more memory and increasing the size of the database.

I have not done any testing on it, but it does not seem to matter.

References are supposed to be cleaned up when the variable goes out of scope.

Its really not much hassle and its always best to clean up your objects when you're finished with them to free up resources immediately regardless of what happens in the program. ADO recordsets lack a State property, and you don't use connection objects.

ADO doesn't have the reference counting problem that DAO does, so you don't need to clean up after.

that in mind, this article from the Microsoft Knowledge Base entitled "How to prevent database bloat after you use Data Access Objects (DAO)", tells you that you should explicitly close if you don't want your databases to bloat.

You'll notice that the article is a little vague about the details; the "Cause" section is unclear, almost to the point of being gibberish.

Presumably this has improved with later versions of the software, but it was at one time not reliable.

I believe that it remains a good practice to explicitly set variables to "Nothing." When you are using ASP classic (server-side scripting), it is import to set all objects to nothing when you are through with them, because they do not go out of scope until the [virtual] server is shut down.

For this reason, all MS VB scripting examples always showed objects being closed and set to nothing.