recordset name poblem

Discussion in 'ASP General' started by Dr.Gizmo, Apr 23, 2004.

  1. Dr.Gizmo

    Dr.Gizmo Guest

    Hello!

    How can I generate random recordset name in do while loop, every time
    that loop pass my code. example:

    do while something

    Set dpconn1 = spoj.Execute("SELECT * FROM txt WHERE number = 1")
    if not dpconn1.EOF then
    Do while not dpconn1.EOF

    ...

    dpconn1.movenext
    loop
    end if
    dpconn1.Close
    set dpconn1 = Nothing

    loop

    so I want that name dpconn1 is different in every loop, for example in
    second run it should be called dpconn2, and like that until do while
    is not over...

    I need this, because I'm calling function inside that same function,
    so there would be the same recordset name, example:

    function a1()
    Set dpconn1 = spoj.Execute("SELECT * FROM txt WHERE number = 1")
    if not dpconn1.EOF then
    Do while not dpconn1.EOF

    '++++this is a1 inside a1
    Set dpconn1 = spoj.Execute("SELECT * FROM txt WHERE number = 2")
    if not dpconn1.EOF then
    Do while not dpconn1.EOF

    'next is a1 inside a1, which is inside original a1, and so...
    ...

    dpconn1.movenext
    loop
    end if
    dpconn1.Close
    set dpconn1 = Nothing
    '++++

    dpconn1.movenext
    loop
    end if
    dpconn1.Close
    set dpconn1 = Nothing
    end function

    thanx!
    :)
    Dr.Gizmo, Apr 23, 2004
    #1
    1. Advertising

  2. Dr.Gizmo

    Ken Schaefer Guest

    Why are you doing what you are doing?

    Cheers
    Ken


    "Dr.Gizmo" <> wrote in message
    news:...
    : Hello!
    :
    : How can I generate random recordset name in do while loop, every time
    : that loop pass my code. example:
    :
    : do while something
    :
    : Set dpconn1 = spoj.Execute("SELECT * FROM txt WHERE number = 1")
    : if not dpconn1.EOF then
    : Do while not dpconn1.EOF
    :
    : ...
    :
    : dpconn1.movenext
    : loop
    : end if
    : dpconn1.Close
    : set dpconn1 = Nothing
    :
    : loop
    :
    : so I want that name dpconn1 is different in every loop, for example in
    : second run it should be called dpconn2, and like that until do while
    : is not over...
    :
    : I need this, because I'm calling function inside that same function,
    : so there would be the same recordset name, example:
    :
    : function a1()
    : Set dpconn1 = spoj.Execute("SELECT * FROM txt WHERE number = 1")
    : if not dpconn1.EOF then
    : Do while not dpconn1.EOF
    :
    : '++++this is a1 inside a1
    : Set dpconn1 = spoj.Execute("SELECT * FROM txt WHERE number = 2")
    : if not dpconn1.EOF then
    : Do while not dpconn1.EOF
    :
    : 'next is a1 inside a1, which is inside original a1, and so...
    : ...
    :
    : dpconn1.movenext
    : loop
    : end if
    : dpconn1.Close
    : set dpconn1 = Nothing
    : '++++
    :
    : dpconn1.movenext
    : loop
    : end if
    : dpconn1.Close
    : set dpconn1 = Nothing
    : end function
    :
    : thanx!
    : :)
    Ken Schaefer, Apr 24, 2004
    #2
    1. Advertising

  3. Dr.Gizmo

    Dr.Gizmo Guest

    "Ken Schaefer" <> wrote in message news:<>...
    > Why are you doing what you are doing?
    >
    > Cheers
    > Ken


    ....because, I'm building category list (tree view), and every category
    may have unlimited subcategories, and so on...

    I could solve this easily with loop in loop (f.e. ten times), but then
    I would be limited to 10 level subcats, an I need it to be unlimited,
    which requires changing name of record set in every loop dynamicly.

    There is solution in 'execute' command:

    dpconn1 = "RS"
    strng = "Set "&dpconn1&" = spoj.Execute(""SELECT * FROM txtWHERE nivo
    = "&nivonext&" AND prekat = '"&prekatnext&"'"")" & vbCrLf
    strng = strng & ...
    execute strng

    But this solution is complicated, and I was wondering is there any
    easier solution?
    Dr.Gizmo, Apr 24, 2004
    #3
  4. Dr.Gizmo

    dlbjr Guest

    there are many far easier ways!

    recordset objects are high priced items in code. Just think of the
    processing burn on the server when 100 or more users hit the sight at the
    same time.

    Ouch!

    dlbjr
    dlbjr, Apr 24, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Haydin

    Install Poblem MATH::Pari

    Haydin, Mar 18, 2005, in forum: Perl
    Replies:
    0
    Views:
    1,417
    Haydin
    Mar 18, 2005
  2. Ruvim Pinka

    poblem with Java ( XP SP2)

    Ruvim Pinka, Nov 17, 2004, in forum: Java
    Replies:
    5
    Views:
    2,333
    Ruvim Pinka
    Nov 19, 2004
  3. Richard
    Replies:
    1
    Views:
    337
    Victor Bazarov
    Aug 13, 2005
  4. Hung Huynh
    Replies:
    8
    Views:
    300
    Bob Barrows
    Sep 24, 2003
  5. James Byrne
    Replies:
    1
    Views:
    192
    Ryan Davis
    Mar 10, 2011
Loading...

Share This Page