标题:ADODB.Recordset 错误 '800a0bb9' ,请高手解决
只看楼主
xjdlydd
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2005-11-25
 问题点数:0 回复次数:13 
ADODB.Recordset 错误 '800a0bb9' ,请高手解决

感谢斑竹和各位高手对小弟的帮助,以下问题希望得到解决

错误提示:

ADODB.Recordset 错误 '800a0bb9'

变量或者类型不正确,或者不在可以接受的范围之内,要不就是与其他数据冲突。

/Car_Search.asp,行33



错误代码显示如下:

<%
dim sql,str,memberPrice,rs,fa_class
dim pages,records,currentpage,linenumber,line,p

fa_class=request("fa_class")

Set rs = Server.CreateObject("ADODB.Recordset")
if fa_class="按汽车类型搜索" then
sql="select * from product order by id desc"
else if fa_class="轿车类" then
sql="select * from product where fa_class like '%轿车类%'"
else if fa_class="客车类" then
sql="select * from product where fa_class like '%客车类%'"
else if fa_class="货车类" then
sql="select * from product where fa_class like '%货车类%'"
else if fa_class="面包车类" then
sql="select * from product where fa_class like '%面包车类%'"
else if fa_class="越野车类" then
sql="select * from product where fa_class like '%越野车类%'"
end if
end if
end if
end if
end if
end if
rs.open sql,conn,3,2 '这就是错误的地方
if rs.eof and rs.bof then str="目前没有您需要的汽车类型,请重新搜索!"
'分页设置
if str="" then
rs.PageSize=10
pages=rs.pagecount
records=rs.recordcount
currentpage=request("currentpage")
if currentpage="" or currentpage<1 then currentpage=1
currentpage=cint(currentpage)
if currentpage>pages then currentpage=pages
rs.absolutepage=currentpage
else
currentpage=1
records=0
pages=1
end if
%>

[此贴子已经被作者于2005-11-25 14:14:32编辑过]

搜索更多相关主题的帖子: Recordset ADODB face 宋体 
2005-11-25 13:17
caiyakang
Rank: 2
等 级:新手上路
威 望:5
帖 子:2111
专家分:0
注 册:2005-3-24
得分:0 
select case fa_class
case "按汽车类型搜索"
sql="select * from product order by id desc"
case""
sql="select * from product where fa_class like '%轿车类%'"
case""
sql="select * from product where fa_class like '%客车类%'"
case""
sql="select * from product where fa_class like '%货车类%'"
case""
sql="select * from product where fa_class like '%面包车类%'"
case""
sql="select * from product where fa_class like '%越野车类%'"
end select
怎么这么多end if,用select case""

中国人的财富网:http://www..cn/
2005-11-25 13:34
rainic
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:2367
专家分:0
注 册:2005-8-9
得分:0 
if fa_class="按汽车类型搜索" then
sql="select * from product order by id desc"
else if fa_class="轿车类" then
sql="select * from product where fa_class like '%轿车类%'"
else if fa_class="客车类" then
sql="select * from product where fa_class like '%客车类%'"
else if fa_class="货车类" then
sql="select * from product where fa_class like '%货车类%'"
else if fa_class="面包车类" then
sql="select * from product where fa_class like '%面包车类%'"
else if fa_class="越野车类" then
sql="select * from product where fa_class like '%越野车类%'"
end if
end if
end if
end if
end if
end if
======================
改成:
if fa_class="按汽车类型搜索" then
sql="select * from product order by id desc"
elseif fa_class="轿车类" then
sql="select * from product where fa_class like '%轿车类%'"
elseif fa_class="客车类" then
sql="select * from product where fa_class like '%客车类%'"
elseif fa_class="货车类" then
sql="select * from product where fa_class like '%货车类%'"
elseif fa_class="面包车类" then
sql="select * from product where fa_class like '%面包车类%'"
elseif fa_class="越野车类" then
sql="select * from product where fa_class like '%越野车类%'"
end if


2005-11-25 13:39
xjdlydd
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2005-11-25
得分:0 
以下是引用rainic在2005-11-25 13:39:00的发言:

改成:
if fa_class="按汽车类型搜索" then
sql="select * from product order by id desc"
elseif fa_class="轿车类" then
sql="select * from product where fa_class like '%轿车类%'"
elseif fa_class="客车类" then
sql="select * from product where fa_class like '%客车类%'"
elseif fa_class="货车类" then
sql="select * from product where fa_class like '%货车类%'"
elseif fa_class="面包车类" then
sql="select * from product where fa_class like '%面包车类%'"
elseif fa_class="越野车类" then
sql="select * from product where fa_class like '%越野车类%'"
end if

改成这个后还是有问题
显示错误还是:

ADODB.Recordset 错误 '800a0bb9'

变量或者类型不正确,或者不在可以接受的范围之内,要不就是与其他数据冲突。

/Car_Search.asp,行24




问题还没解决,不过多谢各位高手的指导

2005-11-25 13:49
xjdlydd
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2005-11-25
得分:0 
以下是引用caiyakang在2005-11-25 13:34:00的发言:
select case fa_class
case "按汽车类型搜索"
sql="select * from product order by id desc"
case""
sql="select * from product where fa_class like '%轿车类%'"
case""
sql="select * from product where fa_class like '%客车类%'"
case""
sql="select * from product where fa_class like '%货车类%'"
case""
sql="select * from product where fa_class like '%面包车类%'"
case""
sql="select * from product where fa_class like '%越野车类%'"
end select
怎么这么多end if,用select case""

多谢,这样改了是可以了
但是搜索结果都是'%轿车类%'里的值,分类条件不起作用

[此贴子已经被作者于2005-11-25 14:01:22编辑过]

2005-11-25 13:51
rainic
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:2367
专家分:0
注 册:2005-8-9
得分:0 
if fa_class="按汽车类型搜索" then
sql="select * from product order by id desc"
elseif fa_class="轿车类" then
sql="select * from product where fa_class like '%轿车类%'"
elseif fa_class="客车类" then
sql="select * from product where fa_class like '%客车类%'"
elseif fa_class="货车类" then
sql="select * from product where fa_class like '%货车类%'"
elseif fa_class="面包车类" then
sql="select * from product where fa_class like '%面包车类%'"
elseif fa_class="越野车类" then
sql="select * from product where fa_class like '%越野车类%'"
else
sql="select * from product where fa_class like '%越野车类%'"
end if

加上红色的再试,这个错误可能是因为fa_class为空

2005-11-25 13:53
xjdlydd
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2005-11-25
得分:0 
以下是引用rainic在2005-11-25 13:53:00的发言:
if fa_class="按汽车类型搜索" then
sql="select * from product order by id desc"
elseif fa_class="轿车类" then
sql="select * from product where fa_class like '%轿车类%'"
elseif fa_class="客车类" then
sql="select * from product where fa_class like '%客车类%'"
elseif fa_class="货车类" then
sql="select * from product where fa_class like '%货车类%'"
elseif fa_class="面包车类" then
sql="select * from product where fa_class like '%面包车类%'"
elseif fa_class="越野车类" then
sql="select * from product where fa_class like '%越野车类%'"
else
sql="select * from product where fa_class like '%越野车类%'"
end if

加上红色的再试,这个错误可能是因为fa_class为空

加上以后不管搜索条件是什么,返回的都是'%越野车类%'里的值

[此贴子已经被作者于2005-11-25 14:03:19编辑过]

2005-11-25 14:00
rainic
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:2367
专家分:0
注 册:2005-8-9
得分:0 
什么呀???
你这个错误可能是因为fa_class为空!!

2005-11-25 14:04
xjdlydd
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2005-11-25
得分:0 
现在情况是fa_class不为空

如果是你说的那样
if rs.eof and rs.bof then str="目前没有您需要的汽车类型,请重新搜索!"
这句话不起作用啊

[此贴子已经被作者于2005-11-25 14:08:32编辑过]

2005-11-25 14:06
islet
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:89
帖 子:6548
专家分:0
注 册:2005-1-28
得分:0 
sql="select * from product where fa_class like '"&fa_class&"' order by id desc"

fa_class字段类型是什么
2005-11-25 14:09



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-35112-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.345208 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved