-
memory implications
i just wanted to know the difference and the amount of meory we save in these two statements.
suppose i have
dim rs as adodb.recordset
now i the open the recordset.
and when i m finished i close it.
rs.close
but i do not set rs=nothing like this
set rs=nothing.
i know by setting rs=nothing i release the memory i have used for the recordset.
but then by writing rs.close
do i have any advantage.
what happens exactly when i write rs.close.
is there any memory i m saving in that way.
actually i do not want to set my recordset to nothing now, bcoz i know i have to use it a little later.
so will closing the recordset be of any use or i should leave it open.
i will be thankful for any help.
bye
-
Closing a recordset simply says "I am done with this data". It has no memory implications.
-
thanks for ur quick reply.
and just one more question
u mean to say,
this statement is optional
that is, if i do not write it and just say
set rs=nothing.
also please let me know
which approach is better
using a
select * from table in rs.open
and then using filters and finds to manupulate the recorset.
or
using a conditional statement in rs.open and when we have finished
then close the recordset and then
again open the recordset with a diffetent select statement and work on it.
and finally set rs to nothing.
here i just wanted to know if opening the recordset a number of times will make my program slow or any other knid of problem.
i really have a lots of questions on these.
so please help me.
thanks and thanks a lot.
-
You should use rs.close every time you are done with the data in the recordset.
Only use set rs=nothing when you are cleaning up (usually when program exits)
Actually you don't usually need set rs=nothing, vb usually does it automatically.
The number of times you open and close a recordset doesn't matter.