🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.basic.visual.misc
Article #425

Nested Loops

#425
From: Chad Gough
Date: Wed, 07 Apr 1999 00:00
61 lines
2395 bytes
I have 2 loops in an ASP page.
sql1 with rsa (sql call 1 with record set a)
sql2 with rsb (sql call 2 with record set b)

<%
On Error Resume Next
rsa.MoveFirst
do while Not rsa.eof
art = Server.HTMLEncode(rsa.Fields("Artist").Value)
%>

                                <table with first record from sql1>
<%
On Error Resume Next
rsb.MoveFirst
do while Not rs.eof
%>
                                                <table with first record
from sql2 where value is from sql1>
                                                <table with second record
from sql2 where value is from sql1>
                                                <table with third record
from sql2 where value is from sql1>

<%
rsb.MoveNext
loop
%>
<%
rsa.MoveNext
loop
%>

The results I WANT are:

RecordA
        Value1
        Value2
        Value3
RecordB
        Value4
        Value5
        Value6
(values 1, 2, and 3 have a value of A in field2 and values 4, 5, and 6 have
a value of B in field2)

I'm GETTING:
RecordA
        Value1
        Value2
        Value3
RecordB
        Value1
        Value2
        Value3

The call to sql2 only seems to work in the first loop.  Do I have to reset
rsb or something?  If so how?


Thanks.
Technical Details
Message-ID: <ChxO2.6781$033.1981@news.rdc1.il.home.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 110e3b,6178036bc48038df,start
X-Google-Attributes: gid110e3b,public
X-Google-Thread: 10ce47,6178036bc48038df,start
X-Google-Attributes: gid10ce47,public
X-Google-Thread: 1477ed,6178036bc48038df,start
X-Google-Attributes: gid1477ed,public
X-Google-Thread: fdea5,6178036bc48038df,start
X-Google-Attributes: gidfdea5,public
X-Google-Thread: 108db9,6178036bc48038df,start
X-Google-Attributes: gid108db9,public
From: "Chad Gough" <chad131@home.com>
Subject: Nested Loops
Date: 1999/04/07
Message-ID: <ChxO2.6781$033.1981@news.rdc1.il.home.com>
X-Deja-AN: 463437009
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
X-Complaints-To: abuse@home.net
X-Trace: news.rdc1.il.home.com 923443426 24.2.195.246 (Tue, 06 Apr 1999 17:03:46 PDT)
Organization: @Home Network
X-MSMail-Priority: Normal
NNTP-Posting-Date: Tue, 06 Apr 1999 17:03:46 PDT
Newsgroups: comp.lang.basic.visual.misc,cz.comp.microsoft.asp,fidonet.asp,microsoft.public.inetexplorer.ie5beta.programming.dhtml.authoring,microsoft.public.inetserver.iis.activeserverpages