Re: Do While Loop nested in another While causes error



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.





.



Relevant Pages

  • Re: Do While Loop nested in another While causes error
    ... still doesn't explain why a nested DO loop would cause problems. ... Until you sort out the contents of the recordset, ... display that new ID. ... response.Write the value of idHolder within the loopto see if it ...
    (microsoft.public.inetserver.asp.db)
  • Re: DAO MUCH faster than ADO in this test
    ... DAO is well-known to be faster than ADO. ... Of course the DAO loop ran faster than the SQL loop; ... advantage of a table-type recordset, which only works on local tables. ... Dim starttime As Single, finishtime As Single ...
    (microsoft.public.access.modulesdaovba)
  • Re: Do While Loop nested in another While causes error
    ... still doesn't explain why a nested DO loop would cause problems. ... Until you sort out the contents of the recordset, ... idHolder = rsGuestbook ... display that new ID. ...
    (microsoft.public.inetserver.asp.db)
  • Re: Do While Loop nested in another While causes error
    ... Until you sort out the contents of the recordset, ... idHolder = rsGuestbook ... Initially the ID's are the same, so the inner loop does the movenext ... display that new ID. ...
    (microsoft.public.inetserver.asp.db)
  • Re: Do While Loop nested in another While causes error
    ... the outter loop, why do you have two different recordset name? ... myRecordset,rsMyRecordset, are these two indicated one recordset? ... make sure rsGuestbook isn't null before the inner loop, ... To display I use a the following basic setup. ...
    (microsoft.public.inetserver.asp.db)