Re: Do While Loop nested in another While causes error
- From: "Mal Reeve" <mal_lori@xxxxxxxxxxx>
- Date: Fri, 17 Nov 2006 13:44:04 GMT
My logic tells me that I don't need an outer movenext
Initially the ID's are the same, so the inner loop does the movenext
eventually it "move'snext" then compares and finds that they are now
different,
in which case it moves back to the outer loop...and cycles again to display
that new ID.
That being said, thanks for the write advice...
And although I can't use a DISTINCT due to some differing data (year
specific), I had not even thought about GROUP...and will explore that.
Mal.
"Mike Brind" <uselessfor@xxxxxxxx> wrote in message
news:eMVwZukCHHA.3916@xxxxxxxxxxxxxxxxxxxxxxx
You are still missing a movenext for the outer loop. Also, response.Write
the value of idHolder within the loop(s) to see if it is what you expect.
Having said that, why are you trying to cycle through rows until the ID
changes? Why not change the SQL statement to only select unique
tblAlumniID's using GROUP BY Or DISTINCT?
--
Mike Brind
"Mal Reeve" <mal_lori@xxxxxxxxxxx> wrote in message
news:w8i7h.7247$0r.971@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I was summarizing the code...sorry.
Here is the applicable loops in question, thanks for any advice.
Mal.
-----------------------------------------------
'This code follows other page elements.
' Error occurs at second DO loop
rsGuestbook.Open strSQL, adoCon
Response.Write("<table width='100%' border='0' cellpadding='0'
cellspacing='0' bordercolor='#FFFFFF'>")
Dim idHolder
'Loop through the recordset
Do While not rsGuestbook.EOF
Response.Write ("<tr>")
Response.Write ("<td width='15%' valign='top'><font
color='#336633'>First Name: </font></td>")
Response.Write ("<td><strong>")
Response.Write(rsGuestbook("tblAlumniFirstName"))
Response.Write ("</font></td></tr><tr>")
Response.Write ("<td valign='top'></strong><font color='#336633'>Last
Name: </td>")
Response.Write ("<td><strong>")
Response.Write (rsGuestbook("tblAlumniLastName"))
Response.Write ("</font></td></strong></tr>")
if len(rsGuestbook("tblAlumniMaidName")) > 3 then
Response.Write ("<td valign='top'><font color='#336633'>Maiden
Name: </td>")
Response.Write ("<td>")
Response.Write (rsGuestbook("tblAlumniMaidName"))
Response.Write ("</td></tr>")
end if
Response.Write ("<tr>")
Response.Write ("<td valign='top'><font color='#336633'>Email:
</td>")
Response.Write ("<td>")
Response.Write (rsGuestbook("tblAlumniEmail"))
Response.Write ("</td></tr><tr>")
Response.Write ("<td valign='top'><font color='#336633'>Last Updated:
</td>")
Response.Write ("<td>")
Response.Write(rsGuestbook("tblAlumniDateUpdated"))
Response.Write ("</td></tr><tr>")
Response.Write ("<td colspan='2'
align='center'>----------------------------------------------------------------")
Response.Write ("</td></tr>")
idHolder = rsGuestbook("tblAlumniID")
'This loop keeps moving to the next record until it has a different ID
number. ie. A different person
Do until rsGuestbook("tblAlumniID") <> idHolder
rsGuestbook.MoveNext
loop
Loop
'Reset server objects
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing
"jane" <bidepan@xxxxxxx> wrote in message
news:%23H$G4kdCHHA.3836@xxxxxxxxxxxxxxxxxxxxxxx
I don't know if you posted your code completely, as so far, there are
following problems
1. the outter loop, why do you have two different recordset name?
myRecordset,rsMyRecordset, are these two indicated one recordset?
2. you don't make a move in outter loop,reMyRecordset.movenext?
3. did you define recordset "reGuestbook"? can not tell from your code.
And make sure rsGuestbook isn't null before the inner loop, like adding
if not eof.
hope these help
"Mal Reeve" <mal_lori@xxxxxxxxxxx> wrote in message
news:hh57h.7074$0r.2737@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,
I have a very basic Page that reads from a database and displays the
information
To display I use a the following basic setup.
Do While Not myRecordset.EOF
...display the info I want in a table.
idHolder = rsMYRecordset("tblAlumniID")
Do until rsGuestbook("tblAlumniID") <> idHolder **this line is
referenced in the error message
rsGuestbook.MoveNext
Loop
Loop
My recordset returns multiple hits for many people (represents multiple
years) I use this inner Do/While Loop to skip displaying duplicates.
It causes an error '80020009' on the DO UNTIL (nested) loop.
After displaying the error message, it then continues and correctly
displays the data.
I am very much still a noob with ASP.
Any Advice?
Mal.
.
- Follow-Ups:
- Re: Do While Loop nested in another While causes error
- From: Mike Brind
- Re: Do While Loop nested in another While causes error
- References:
- Do While Loop nested in another While causes error
- From: Mal Reeve
- Re: Do While Loop nested in another While causes error
- From: jane
- Re: Do While Loop nested in another While causes error
- From: Mal Reeve
- Re: Do While Loop nested in another While causes error
- From: Mike Brind
- Do While Loop nested in another While causes error
- Prev by Date: Re: Do While Loop nested in another While causes error
- Next by Date: Re: Do While Loop nested in another While causes error
- Previous by thread: Re: Do While Loop nested in another While causes error
- Next by thread: Re: Do While Loop nested in another While causes error
- Index(es):
Relevant Pages
|