We help IT Professionals succeed at work.

In Classic ASP, How do I convert "Next" query to "Do Until...Loop" query?

erin027
erin027 asked
on
Medium Priority
586 Views
Last Modified: 2012-05-05
I have a query that uses "Next" query. What if I want to use Do Until....Loop query, How do I convert this query to that?
Thank you.

+++++++++++++++++My coding+++++++++++++++++++++++++++++++++++++++++++
<%
Dim itemcount
Itemcount=rs.pagesize

For 1 to Itemcount
%>

<Table>
<tr>
 <td><%=rs("name")%></td>
</tr>
<Table>

<% rs.MoveNext
Next %>
Comment
Watch Question

Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
here we go, using the rs.eof property:
<% 
while not rs.eof
%> 
<Table>
<tr>
 <td><%=rs("name")%></td>
</tr>
<Table> 
<%  
  rs.MoveNext
wend
%>

Open in new window

Author

Commented:
Thanks angellll.
But I need the data from 1 to Itemcount only.
I am trying to display the certain data on each page.
Instead of rs.EOF is there anyway that I can bring data that is from 1 to itemcount?
itemcount is rs.pagesize.

I have rest of the coding but it's too much to post it up. I just need if I can use Do Until...loop query in this situation.
Thank you.
Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009
Commented:
why do you want to change from the FOR .. to a WHILE loop actually?

anyhow:
<%
Dim itemcount
Dim l
Itemcount=rs.pagesize
l = 1
 
while l < Itemcount
%>
 
<Table>
<tr>
 <td><%=rs("name")%></td>
</tr>
<Table>
 
<% 
  rs.MoveNext
  l = l + 1
wend %>

Open in new window

Explore More ContentExplore courses, solutions, and other research materials related to this topic.