光纤熔接 ERP

弱电论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 3518|回复: 1
打印 上一主题 下一主题

求 BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除 的

[复制链接]
跳转到指定楼层
1#
发表于 2008-1-23 11:20:52 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
华为代理商

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

请问是什么原因?如何解决?附:原代码如下。


<%
sql="Select * from Xue_Category"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
Do While Not Rs.eof and Not Rs.bof

CName=rs("CategoryName")
'response.write""
TCount=conn.Execute("Select count(Category) From Xue_News where Category='"&cname&"' group by Category order by Category")(0)
rs("CategorySum")=TCount
Rs.MoveNext
loop
Rs.Close  
set rs=nothing

response.write""
response.end
%>

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享
2#
发表于 2008-1-23 13:16:06 | 只看该作者
华为代理商

原因应该是您的数据中没有相应查询的数据,这样就造成了SQL查询的错误,处理方法如下:

sql="Select * from Xue_Class"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
Do While Not Rs.eof and Not Rs.bof
CName=rs("ClassName")
'response.write""
on error resume next
TCount=conn.Execute("Select count(ClassName) From Xue_News where ClassName='"&cname&"' group by ClassName order by ClassName")(0)
if err then
rs("ClassSum")=0 '无数据时,自动符值0
else
rs("ClassSum")=TCount
end if
Rs.MoveNext
loop
Rs.Close  
set rs=nothing

注意红色部分的处理代码。如果有错误(其实是没有记录,即统计=0),则自动符值=0

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|广告咨询|VIP注册|关于我们|联系我们|积分规则|手机版|Archiver|弱电之家论坛 ( 京ICP备11008917号-3 )

GMT+8, 2024-6-8 07:06 , Processed in 0.108400 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表