PDA

View Full Version : Do Until loop with IF


crmpicco
06-15-2005, 12:40 PM
<%
Do Until rst1.EOF
if trim(rst1("company_name")) = trim(rscompany("company_name")) then
response.write ""
else
%>
<option value="<%=trim(rst1("agencyid"))%>"><%=trim(rst1("company_name"))%></option>
<%
end if
rst1.movenext
loop
%>


I have this structure for a drop-down menu. Basically, i dont want to show one result of the loop. how can i do this?

NancyJ
06-15-2005, 01:04 PM
Whats wrong with what you have posted? Does it not work? What error message do you get?

I would do it like this:


<%
while not rst1.eof
if trim(rst1("company_name")) <> trim(rscompany("company_name")) then

response.write "<option value='"&trim(rst1("agencyid")&"'>"&trim(rst1("company_name"))&"</option>"

end if
rst1.movenext
wend
%>


but thats not fundamentally different to what you have, just a different way of saying the same thing.