意外错误,怎么解决?急!

yangjiehua 2003-12-22 10:49:54
我写的一段程序如下:
<%
if dbrs.RecordCount >0 then
for j=1 to pagesize
%>
<tr <%if j mod 2=0 then response.Write "bgcolor='#FFF3FF' "%><%if j mod 2=1 then response.Write "bgcolor='#FFF3F7' "%>class="bbs0">
......
<%
sql="select * from members where id="&dbrs("author_id")
author_dbrs.Open sql,dbcn,1,1
%>

<td width="32%" bgcolor="#FFF3FF" colspan="2"><b>楼主</b>:<a href="mailto:<%=author_dbrs("email")%>"><%=dbrs("author_name")%></a></td>
<td width="68%" bgcolor="#FFF3FF">
<table width="100%" border="0" ID="Table2">
<tr>
<td width="80%">主题:<%=dbrs("bbs_title")%></td>
<td width="20%" align="center"><a href="meirongM.htm"><strong>专家回复</strong></a></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center" width="13%" valign="top"><img src="/images/face/image<%=author_dbrs("face")%>.gif"></td>
<td bgcolor="#fffbff" width="19%" valign="top"> <font color="#666666">来自:</font><br>
 
<%=dbrs("author_IP")%><br>
<font color="#666666">时间:</font><br>
 
<%=formatdatetime(dbrs("add_time"),2)%><br>
 
<%=formatdatetime(dbrs("add_time"),3)%> </td>
<td bgcolor="#ffffff" widht="68%" valign="top"><%=replace(replace(dbrs("bbs_content"),chr(13),"<br>"),chr(32)," ")%> </td>
</tr>
<%
author_dbrs.close
dbrs.Close
sql = "select * from bbs where parent_id="&dbrs("id")&" order by id" /第148行
dbrs.Open sql,dbcn,1,1
for i=1 to dbrs.RecordCount
sql="select * from members where id="&dbrs("author_id")
author_dbrs.Open sql,dbcn,1,1
%>

运行后出现如下错误。
错误 '80020009'
发生意外。

/bbsdetail.asp,行148
...全文
81 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
yangjiehua 2003-12-23
  • 打赏
  • 举报
回复
按楼上所说的 换位之后出现以下错误
ADODB.Recordset 错误 '800a0bcd'
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。

/bbsdetail.asp,行178
源代码如下:
<!--#include virtual="/public_files/dbconn.asp"-->
<%

set dbrs=server.CreateObject("adodb.recordset")
sql="select * from bbs where close=0 and parent_id=0 order by id desc"
dbrs.Open sql,dbcn,1,1
set author_dbrs=server.CreateObject("adodb.recordset")
pagesize=20
%>
<!--#include virtual="/public_files/pages_top.asp"-->
.......
<%
if dbrs.RecordCount >0 then
for j=1 to pagesize
%>
<tr <%if j mod 2=0 then response.Write "bgcolor='#FFF3FF' "%><%if j mod 2=1 then response.Write "bgcolor='#FFF3F7' "%>class="bbs0">
<td width="2%"><img src="/images/yellowarrow.gif" border="0"></td>
<td class="bbs"><table width="100%" border="1" cellpadding="4" cellspacing="0" ID="Table6" bordercolorlight="#AAAAAA" bordercolordark="#FFFFFF">
<%
sql="select * from members where id="&dbrs("author_id")
author_dbrs.Open sql,dbcn,1,1
%>
<tr class="titlie">
<td width="32%" bgcolor="#FFF3FF" colspan="2"><b>楼主</b>:<a href="mailto:<%=author_dbrs("email")%>"><%=dbrs("author_name")%></a></td>
<td width="68%" bgcolor="#FFF3FF">
<table width="100%" border="0" ID="Table2">
<tr>
<td width="80%">主题:<%=dbrs("bbs_title")%></td>
<td width="20%" align="center"><a href="meirongM.htm"><strong>专家回复</strong></a></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center" width="13%" valign="top"><img src="/images/face/image<%=author_dbrs("face")%>.gif"></td>
<td bgcolor="#fffbff" width="19%" valign="top"> <font color="#666666">来自:</font><br>
 
<%=dbrs("author_IP")%><br>
<font color="#666666">时间:</font><br>
 
<%=formatdatetime(dbrs("add_time"),2)%><br>
 
<%=formatdatetime(dbrs("add_time"),3)%> </td>
<td bgcolor="#ffffff" widht="68%" valign="top"><%=replace(replace(dbrs("bbs_content"),chr(13),"<br>"),chr(32)," ")%> </td>
</tr>
<%
author_dbrs.close
sql = "select * from bbs where parent_id="&dbrs("id")&" order by id"
dbrs.Close
dbrs.Open sql,dbcn,1,1
for i=1 to dbrs.RecordCount
sql="select * from members where id="&dbrs("author_id")
author_dbrs.Open sql,dbcn,1,1
%>
<tr class="titlie">
<td width="30%" bgcolor="#FFF3F7" colspan="2"><span class="style2">专家回复:</span></td>
<td width="70%" bgcolor="#FFF3F7">标题:<%=dbrs("bbs_title")%></td>
</tr>
<tr>
<td align="center" width="13%" valign="top"><img src="/images/face/image<%=author_dbrs("face")%>.gif"></td>
<td bgcolor="#fffbff" width="19%" valign="top"> <font color="#666666">来自:</font><br>
 
<%=dbrs("author_IP")%><br>
<font color="#666666">时间:</font><br>
 
<%=formatdatetime(dbrs("add_time"),2)%><br>
 
<%=formatdatetime(dbrs("add_time"),3)%> </td>
<td bgcolor="#ffffff" widht="68%" valign="top"><%=replace(replace(dbrs("bbs_content"),chr(13),"<br>"),chr(32)," ")%> </td>
</tr>
<%
author_dbrs.close
dbrs.MoveNext
next
%>
</table>
</tr>
<%
dbrs.MoveNext/ 第178行第178行第178行第178行
if dbrs.EOF then exit for
next
end if
%>
fifaqzx 2003-12-23
  • 打赏
  • 举报
回复
最好用两个recordset这样或许能加快点执行速度
fifaqzx 2003-12-23
  • 打赏
  • 举报
回复
上面我的不对

dbrs.close
sql="select * from bbs where close=0 and parent_id=0 order by id desc"
dbrs.Open sql,dbcn,1,1
dbrs.Move j

把这几句加在出错句前面
fifaqzx 2003-12-23
  • 打赏
  • 举报
回复
for i=1 to dbrs.RecordCount 此句改为
for i=2 to dbrs.RecordCount 或 for i=1 to dbrs.RecordCount-1
patchclass 2003-12-22
  • 打赏
  • 举报
回复
/bbsdetail.asp,行148
是哪行啊
fifaqzx 2003-12-22
  • 打赏
  • 举报
回复
dbrs.Close
sql = "select * from bbs where parent_id="&dbrs("id")&" order by id"

这两句换换位

28,406

社区成员

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

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