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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to break a while loop?

Status
Not open for further replies.

AlbertAguirre

Programmer
Nov 21, 2001
273
US
Noob here!
I need to break out of a while loop but cant. How?

CODE:

<%
dim cntr
dim maxrecs

cntr = 0
maxrecs = 5

WHILE not rsFeatured.eof
if cntr = maxrecs then
break (????)
end if
[DO SOMETHING]
WEND
%>
 
I would try something like this
Code:
<%
dim cntr
dim maxrecs

bFlag = True
cntr = 0
maxrecs = 5

WHILE not rsFeatured.eof
    If cntr = maxrecs then
        rsFeatured.MoveLast
    Else
      [DO SOMETHING]
      rsFeatured.MoveNext
    End If
WEND
%>
Hope this helps
 
not sure what you are trying to do...but

<%
dim cntr
dim maxrecs

cntr = 0
maxrecs = 5

Do WHILE not rsFeatured.eof
if cntr = maxrecs then exit do
[DO SOMETHING]
WEND
%>

-DNG
 
Isn't there an exit loop or an exit while, do a search on google
 
To answer your original question, yes tere is a break, look at Cullen411's post.

To answer your unasked question, it appears your trying to show portions of your recordset at a time. You might get better performance if you looked into using the built in paging available withthe recordset object. Key recordset attributes being AbsolutePage and PageSize.

barcode_1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top