ADODB.Field错误'800a0bcd'
BOF或EOF为True,或者当前记录已被删除。请求的操作需要当前记录。
/Index.asp,第216行
和第216行-
<%ip=0
set rsEx=conn.execute("select * from products where featured=1")
while not rsEx.eof
ip=ip+1
set rsMasSku=conn.execute("select top 1* from productSkus where masterid="&rsEx("id")&" order by price")
dprice=rsMasSku("dprice")
price=rsMasSku("price")
if cDbl(dprice) > 0 then
finalPrice=cDbl(price)-cDbl(price)*cDbl(dprice)/100
else
finalPrice=price
end if
%>
答案 0 :(得分:0)
错误的来源很可能是以下代码块:
set rsMasSku=conn.execute("select top 1* from productSkus where masterid="&rsEx("id")&" order by price")
dprice=rsMasSku("dprice")
price=rsMasSku("price")
现在发生的情况是,如果第二个rsMasSku记录集未返回给定rsEx(“ id”)值的数据,则对rsMasSku(“ dprice”)或rsMasSku(“ price”的引用)根本不存在,并返回错误。
因此解决方案是添加一个EOF检查(类似于rsMasSku记录集的实例化之后的while not rsEx.eof
:
set rsMasSku=conn.execute("select top 1* from productSkus where masterid="&rsEx("id")&" order by price")
if not rsMasSku.EOF then
' ... now you can access the rsMasSku fields et cetera ...
else
' ... do nothing ... or maybe think of something else to do ...
end if