Reusing a RS

Results 1 to 3 of 3

Thread: Reusing a RS

  1. #1
    Join Date
    Dec 1969
    Posts
    97

    Default Reusing a RS

    Is it possible to execute a new SQL statement with an existing RS (A) inside a do while loop that is stepping through a different RS (B). Every time I try it gives me an error. I debugged a bit and it seems that RS A is empty when I hit the second record of RS B.<BR><BR>Example...<BR>Do While Not Cand_RS.EOF<BR> SQLQuery2 = "Select * from ED where id = " & Cand_RS("ID") & ";"<BR> Set Results_RS = Data_Con.Execute(SQLResults) <BR> Do while Not Results_RS.EOF<BR> Response.write Results_RS("LName")<BR> Results_RS.MoveNext<BR> Loop<BR><BR>Cand_RS.MoveNext<BR>Loop

  2. #2
    Mark Vick Guest

    Default RE: Reusing a RS

    This is a shot in the dark, but try renaming to RS and RS1, but only after checking this: In your code, you set Results_RS to Execute(SQLResults) and I think you may want to set Results_RS to Execute(SQLQuery2)!

  3. #3
    Join Date
    Dec 1969
    Posts
    97

    Default RE: Reusing a RS

    OK, I just made a typo. <BR>I thought of renaming the RS in each loop, but I could have up to 100 RS&#039s then. I thought that would impact performance too much.

Posting Permissions

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