Print Page | Close Window

2 recordsets in a while loop

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=1594
Printed Date: 29 March 2026 at 12:51am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: 2 recordsets in a while loop
Posted By: ngaisteve1
Subject: 2 recordsets in a while loop
Date Posted: 04 April 2003 at 2:41am

do while NOT rs_issue.eof
do while NOT rs_receiving.eof

...

rs_receiving.movenext
LOOP
rs_issue.movenext
LOOP

Actually, how my syntax should be?

I would to loop within 2 table but I just get the rs_receiving right but still not both recordset.

Anyone knows how?




Replies:
Posted By: MadDog
Date Posted: 04 April 2003 at 2:44am

i dont understand what you are trying to do.

Can you please give us some more details.



-------------
http://www.iportalx.net" rel="nofollow">


Posted By: ngaisteve1
Date Posted: 06 April 2003 at 7:01pm
What I really want is to generate a report from 2 table. But, since there is a need to sort those report and also I if I combine every tables together and with the conditions and order, it will be very very long.


Posted By: Auritania
Date Posted: 10 April 2003 at 2:18pm
If it is an access database, use the graphical query builder till it works and then switch to SQL view and copy the statement over. Makes big, ugly complex SQL statments easy for those of us that are SQL challenged.


Posted By: ngaisteve1
Date Posted: 10 April 2003 at 7:51pm
I am using mysql


Posted By: Coco Brown
Date Posted: 11 April 2003 at 5:09pm

check that both your recordsets have records in them.  According to your code, if rs_issue has no records in it, then the rs_recieving loop will be ignored.  If the tables are relatively similiar, I would advise joining them or using UNION.  Otherwise, you would have to find a way to make sure that one recordset set keeps looping if you happened to reach the end of the other.

Try this:

Do while (rs_recieving.eof=false) OR (rs_issue.eof=false)
  if (rs_recieving.eof = false) then
        ...
       rs_recieving.movenext
  end if
  if (rs_issue.eof = false) then
        ...
      rs_issue.movenext
  end if
Loop

I haven't tested this, so I don't know if this will work.

Hope this helps  



Posted By: ngaisteve1
Date Posted: 14 April 2003 at 2:18am
I am done with it already. Anyway, thanks.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net