ASP比较内行的进来看看!

lsqlz 2006-07-19 03:22:26
调试ASP报错 帮小弟看看

错误类型:
ADODB.Field (0x80020009)
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。


源代码
<%
if session("id")="" then
response.redirect "../login/login.asp?pageid=main"
response.end
else
id=session("id")
%>
<!--#include file="dbconn.asp"-->
<!--#include file="../inc/confignew.asp"-->
<%
Set rssort= Server.CreateObject("ADODB.Recordset")
sortsql="select * from class1"
rssort.open sortsql,conn,1,1
%>

<%do while not rssort.eof%>
<TR>
<td width="33%" height="25" align="left"><p style="line-height: 150%"> <a
href="buop.asp?sortid=<%=rssort("sortid")%>"><%=rssort("sort")%></a></td>
<%rssort.movenext%>
<td width="33%" height="25" align="left"><p style="line-height: 150%"> <a
href="buop.asp?sortid=<%=rssort("sortid")%>"><%=rssort("sort")%></a></td>
<% rssort.movenext %>
<td width="33%" height="25" align="left" ><p style="line-height: 150%"> <a
href="buop.asp?sortid=<%=rssort("sortid")%>"><%=rssort("sort")%></a></td>
</TR>
<%
rssort.movenext
loop
rssort.close
%>
...全文
131 8 打赏 收藏 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
dongfangbai 2006-07-19
  • 打赏
  • 举报
回复
每次记录 向下移动的时候加一个判断是否到达记录底部就行了
<%
if session("id")="" then
response.redirect "../login/login.asp?pageid=main"
response.end
else
id=session("id")
%>
<!--#include file="dbconn.asp"-->
<!--#include file="../inc/confignew.asp"-->
<%
Set rssort= Server.CreateObject("ADODB.Recordset")
sortsql="select * from class1"
rssort.open sortsql,conn,1,1
%>

<%do while not rssort.eof%>
<TR>
<td width="33%" height="25" align="left"><p style="line-height: 150%"> <a
href="buop.asp?sortid=<%=rssort("sortid")%>"><%=rssort("sort")%></a></td>
<%rssort.movenext
if not rssort.eof then
%>
<td width="33%" height="25" align="left"><p style="line-height: 150%"> <a
href="buop.asp?sortid=<%=rssort("sortid")%>"><%=rssort("sort")%></a></td>
<% end if
if not rssort.eof then
rssort.movenext
%>
<td width="33%" height="25" align="left" ><p style="line-height: 150%"> <a
href="buop.asp?sortid=<%=rssort("sortid")%>"><%=rssort("sort")%></a></td>
</TR>
<%end if
rssort.movenext
loop
rssort.close
%>
chenyu112 2006-07-19
  • 打赏
  • 举报
回复
DING
lyfer 2006-07-19
  • 打赏
  • 举报
回复
<%do while not rssort.eof%>
<TR>
<td width="33%" height="25" align="left"><p style="line-height: 150%"> <a
href="buop.asp?sortid=<%=rssort("sortid")%>"><%=rssort("sort")%></a></td>
<%
if not rssort.eof then
rssort.movenext
%>
<td width="33%" height="25" align="left"><p style="line-height: 150%"> <a
href="buop.asp?sortid=<%=rssort("sortid")%>"><%=rssort("sort")%></a></td>
<% if not rssort.eof then
rssort.movenext %>
<td width="33%" height="25" align="left" ><p style="line-height: 150%"> <a
href="buop.asp?sortid=<%=rssort("sortid")%>"><%=rssort("sort")%></a></td>
</TR>
<%
end if
end if
rssort.movenext
loop
rssort.close
%>
若白师妹 2006-07-19
  • 打赏
  • 举报
回复
你是想怎样哦?
ahhisoft 2006-07-19
  • 打赏
  • 举报
回复
<%
Dim I
I=1
do while not rssort.eof%>
<%If i Mod 3 = 1 Then Response.Write("<Tr>")%>
<td width="33%" height="25" align="left"><p style="line-height: 150%"> <a
href="buop.asp?sortid=<%=rssort("sortid")%>"><%=rssort("sort")%></a></td>
<td width="33%" height="25" align="left"><p style="line-height: 150%"> <a
href="buop.asp?sortid=<%=rssort("sortid")%>"><%=rssort("sort")%></a></td>
<td width="33%" height="25" align="left" ><p style="line-height: 150%"> <a
href="buop.asp?sortid=<%=rssort("sortid")%>"><%=rssort("sort")%></a></td>
<%If i mod 3 = 0 Then Response.Write("</Tr>")%>
<%
I=I+1
rssort.movenext
loop
rssort.close
%>

改成这样试试
ahhisoft 2006-07-19
  • 打赏
  • 举报
回复
你的tr里面用了太多的<% rssort.movenext %>了!
huntersjf 2006-07-19
  • 打赏
  • 举报
回复
只要记录不是3的倍数的话,运行的时候肯定会报错的
huntersjf 2006-07-19
  • 打赏
  • 举报
回复
你在循环中用了三次movenext,但是你只在最开始判断记录是否为空,如果记录有1条或者2条的话,运行到中间的时候肯定会出错了

28,402

社区成员

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

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