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

IF function & Loop

Status
Not open for further replies.

anastasia

Programmer
Dec 13, 2000
111
GB
Hi, I am using the following VBScript code within an ASP page. The code is as follows:

<% Do while NOT RS.EOF %>
<% IF RS(&quot;Times&quot;) = mytime THEN %>
<% errorForm &quot;Correct. &quot; %>
<% ELSE %>
<% errorForm &quot;Not Correct. &quot; %>
<% END IF %>
<%
RS.MoveNext
Loop
%>

Further above in the page I have connected to the database. Other IF statements are before this and work fine. The mytime variable contains a time that a user enters in a form and this is compared to times held in the database, field name is called Times. I am trying to loop through these times and if the time entered by the user is not equal to any times held in the database then the appropriate message is displayed. However the above code seems only to check the first time in the database table and does not continue through the rest.?

I can't see anything wrong in the code, any ideas?

thanks.
 
Try removing the surplus <%/%> tags. Yours,

Rob.
 
You don't include the source to errorForm but I bet it includes a response.end

If it includes response.end then your page will end before your loop ever completes.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top