还是排序的问题.

qisanyou 2001-11-28 04:23:46
<!-- #include file="conn.asp" -->

<%
set rs1=server.createobject("adodb.recordset")
sql="select top 5 * from book order by todayhit desc"
rs1.open sql,conn,1,1
while not rs.eof
%>


<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20" valign="top"><font color="#0033cc">~</font></td>

<td width="111"><a href="list.asp?id=<%=rs1("id")%>"><%=rs1("title")%></a><font color="#0099FF">[点击数<%=rs1("todayhit")%>]</font></td>
</tr>
</table>


读取点击数最多的五条信息.

错误类型:
Microsoft VBScript 编译器错误 (0x800A03FA)
/files/geng.asp, 第 15 行

错在哪儿?
...全文
64 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
qisanyou 2001-11-28
  • 打赏
  • 举报
回复
搞掂,不是这样写这个循环的,我现在用的源代码如下:
<%
dim u
u=1
set rs3=server.createobject("adodb.recordset")
sql="select top 5 * from book order by todayhit desc"
rs3.open sql,conn,3,3
while not rs3.eof
%>
<tr>

<td bgcolor="#F3F3F3" width="132">
<table width="131" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20" valign="top"><font color="#0033cc">[<%=u%>]</font></td>

<td width="111"><a href="list.asp?id=<%=rs3("id")%>"><%=rs3("title")%></a><font color="#0099FF">[点击数<%=rs3("todayhit")%>]</font></td>
</tr>
</table>
</td>
</tr>
<%
u=u+1
rs3.movenext
wend
rs3.close
set rs3=nothing
%>
</table>
</td>
efax 2001-11-28
  • 打赏
  • 举报
回复
主要是在循环时对象写错了,应当是rs1,并且还要带上 rs.movenext和loop
lilideng 2001-11-28
  • 打赏
  • 举报
回复
循环没写完呀
<%do while not rs.eof%>
…………
<%rs.movenext
loop%>
liaogs 2001-11-28
  • 打赏
  • 举报
回复
<table border="0" cellspacing="0" cellpadding="0">
<%do while not rs1.eof
%>
<tr>
<td width="20" valign="top"><font color="#0033cc">~</font></td>

<td width="111"><a href="list.asp?id=<%=rs1("id")%>"><%=rs1("title")%></a><font color="#0099FF">[点击数<%=rs1("todayhit")%>]</font></td>
</tr>
<% rs1.movenext
loop
%>
</table>

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧