ASP死循环,问题

来源:百度知道 编辑:UC知道 时间:2024/05/04 07:35:47
<%
row=1
col=1
sql="select top 20 * from tblGcompany order by indate desc"
rs.open sql,conn,1,3
for row=1 to 5 step 1
%><tr valign="top"><%
for col=1 to 4 step 1
if rs.eof then %>
<td height="40"><div align="center"><img src="images/zhaozu.jpg" width="88" height="31" border="0"></div></td>
<%
else%>
<td height="40"><div align="center">
<%if rs("url")<>"" then%>
<a href="<%if Instr(rs("url"),"http://")<1 then:response.Write("http://")%><%=rs("url")%>" target="_blank">
<%else%>
<a href="company.asp?tblid=<%=rs("id")%>" t

最好不要用FOR循环!
采用WHILE比较好!
while not rs.eof
<tr><td>一列
<%
rs.movenext
if rs.eof then
response.write""
else
%></td><td>二列
<%
rs.movenext
if rs.eof then
response.write""
else
%></td><td>三列
<%
rs.movenext
if rs.eof then
response.write""
else
%></td><td>四列
<%
rs.movenext
if rs.eof then
response.write""
else
%></td><td>五列td><tr>
<%
rs.movenext
end if
end if
end if
end if
wend
rs.close
set rs=nothing
%>