Results 1 to 4 of 4

Thread: memory implications

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2001
    Posts
    38

    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

  2. #2
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    Closing a recordset simply says "I am done with this data". It has no memory implications.
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2001
    Posts
    38
    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.

  4. #4
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    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.
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width