Results 1 to 2 of 2

Thread: Declaring Variables

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2000
    Location
    Sudbury, Ontario, Canada
    Posts
    274

    Question

    I'm wondering what the best method is for intializing a recordset?

    -------------------------------------------------------
    dim rstCurrent as ADODB.Recordset

    set rstcurrent = new ADODB.Recordset
    rstcurrent.open ...

    -------------------------------------------------------

    OR

    -------------------------------------------------------
    Dim rstCurrent as New ADODB.Recordset

    rstCurrent.open ...

    -------------------------------------------------------

    Thanks


  2. #2
    Member
    Join Date
    Aug 1999
    Posts
    52

    Smile

    Hi,

    Its better to use first method..i.e., declaring it and afterwards seting that objvariable.
    If use the second variable lik...

    Dim adoconn as new adodb.connection

    after that ur using that obj variable inside ur procedure..onzz u finished everythin u will destroy that varaible which in turns releses memory lik tkis..

    adoconn.close
    set adoconn=nothing

    onzz u given that above statement. it will not releases memory b'coz after this if ur refering again this varaiable lik..

    adoconn.cursorlocation=aduseclient

    it will automatically look for the first line for refence and it will work . it wont gives u error onzz u destroyed this..so if ur using this user has not having any control over that obj.variable.

    if ur using the first method. and setiing the connection to nothing n later if ur referencing that it will gives u error..which user has a control over that variable

    so its better to use first method.
    hope u clear..anydoubts let me know..

    kandan.



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