Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordset loop Showing only first record

Status
Not open for further replies.

JordanR

Technical User
Oct 3, 2002
182
US
Can anyone tell me why my loop only the first record as if it is in the database umpteen times?

 
MoveNext maybe?

Guessing without seeing you loop really ;)

___________________________________________________________________

The answer to your ??'s may be closer then you think. faq333-3811
Join the Northern Illinois/Southern Wisconsin members in Forum1064
 
Yeah, I got all that in there
Code:
<%
WHILE NOT rs.EOF
%>
<option value="<%=rs("fieldname")%>"><%=rs("fieldname")%></option>
<%
rs.MoveNext
Wend
%>
 
hmmm..not sure. Like you said it looks fine and should do the job. Can you post the SQL statement. Maybe that is the bad apple in the code.

there are records in there correct? Just checking.

___________________________________________________________________

The answer to your ??'s may be closer then you think. faq333-3811
Join the Northern Illinois/Southern Wisconsin members in Forum1064
 
actually,
I was using variables and it didn't like that... this time. I could have sworn I used variables before.

Thanks
 
My usual looping code

Code:
<%
sql="select * from table1"
rs.Open sql,objCON,3,3
WHILE NOT rs.EOF
%>
<option value="<%=rs("fieldname")%>"><%=rs("fieldname")%></option>
<%
rs.MoveNext
Wend
%>

________
George, M
Searches(faq333-4906),Carts(faq333-4911)
 
1) Double check the source forthe generated HTML (View Source in browser) to make sure the data isn't getting hidden by an HTML formatting issue.
2) Always a good idea to use the .MoveFirst method before looping through a recordset. If you are reordering the recordset it will often be returned with the record pointer in the wrong spot (ie, not the top). A simple:
If Not rs.EOF Then rs.MoveFirst
will take care that without blowing up at you if the recordset is empty (this would be before you start the loop, not in it or after it).

-T

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
The never-completed website:
 
Thanks guys,
issue is resolved.
all have been a great help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top