日期:2014-05-17  浏览次数:20681 次

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

当找到记录的时候没有提示错误,找不到记录的时候报错。

代码:
<!--#include   file= "conn.asp "   -->
<%
        set   jdrs=Server.CreateObject( "ADODB.recordset ")
sql= "select   *   from   Article   where   IS_Review= 'y '   and   Topic_ID=1   and   IS_Focus= 'y '   order   by   Article_ID   DESC "
        jdrs.cursorlocation=3        
        jdrs.cachesize=5    
        jdrs.open   sql,cn,1,3
'response.End()这里加response.end()就不提示错误
if   not   jdrs.eof   then
'response.End()这里加response.end()还是提示错误
picid=jdrs.fields( "pic_id ")
src= "yes "
if   len(ubb(unhtml(jdrs.fields( "content "))))> 180   then
content=left(ubb(unhtml(jdrs.fields( "content "))),180)& "… "
else
content=ubb(unhtml(jdrs.fields( "content ")))
end   if
else
src= "../images/flash01.jpg "
content= "你好 "
end   if
%>


------解决方案--------------------
或者用rs.recordcount是否为0来检测
------解决方案--------------------
说明你数据库没数据?
------解决方案--------------------
在看看你查询语句有没有写对
是不是 你要查询的条件
------解决方案--------------------
晕,eof为真说明你SQL指定的条件查询结果为空,没有记录,你还要继续操作,当然会报错了,

if jdrs.eof then
resposne.write( "没有记录! ")
else
.............

end if
------解决方案--------------------
if not jdrs.eof then
=====================》》》》》》》》》》》
if jdrs.eof or jdrs.bof then
------解决方案--------------------
if (jdrs.eof and not jdrs.bof) then
无记录
else
有记录

end if