set rs = nothing really necessary (1 Viewer)

casey

Registered User.
Local time
Today, 05:47
Joined
Dec 5, 2000
Messages
448
hello,

quick ADO question...

Must I (set rs = nothing) when I'm done? I've always done that, but seeing a lot of code that neglects doing so. Is it advisable to do or can I merely use. (rs.close)

What are the consequences of not setting = nothing?

Also, should I wait until I'm finished with the rs at the end of the code? or should I set rs = nothing for every recordset that i open regardless if I reuse the recordset over and over?

Thanks.
 

boblarson

Smeghead
Local time
Yesterday, 21:47
Joined
Jan 12, 2001
Messages
32,059
You don't have to destroy the variable by setting it equal to nothing until you are through with it, but you should do so before exiting your program. Setting it to nothing is basic garbage collection and removes the object from memory and without doing so you can wind up causing "memory leak."
 

casey

Registered User.
Local time
Today, 05:47
Joined
Dec 5, 2000
Messages
448
thanks. boblarson,

So this would have no effect on locking tables/recordsets? As long as the recordset is closed?
 

casey

Registered User.
Local time
Today, 05:47
Joined
Dec 5, 2000
Messages
448
Thanks again.

I have a recordset (one table) that I open, update(one field) and close the rs with ADO. After doing all of this, the table remains inaccessible and I can't access it through Enterprise Manager or Access. Is there something that you can think of that would cause the table to remian locked after it's updated and closed.
 

boblarson

Smeghead
Local time
Yesterday, 21:47
Joined
Jan 12, 2001
Messages
32,059
What is the full code you are using to access it?
 

casey

Registered User.
Local time
Today, 05:47
Joined
Dec 5, 2000
Messages
448
Thanks for your help. I will repost when I get the time.
 

Users who are viewing this thread

Top Bottom