新微赢技术网

标题: ADODB.Recordset 错误 '800a0bb9' ,请高手解决 [打印本页]

作者: 边走边看    时间: 2010-1-14 00:07
标题: 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
%>
作者: lianeh    时间: 2010-1-14 00:07
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""
作者: 羽衣独舞    时间: 2010-1-14 00:07
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
作者: 青松    时间: 2010-1-14 00:07
以下是引用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




问题还没解决,不过多谢各位高手的指导
作者: ▄愛變鎖ゞ    时间: 2010-1-14 00:07
以下是引用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""
多谢,这样改了是可以了
但是搜索结果都是'%轿车类%'里的值,分类条件不起作用
作者: 劳资ぶ龍哥    时间: 2010-1-14 00:08
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为空
作者: 海的无奈    时间: 2010-1-14 00:08
以下是引用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为空
加上以后不管搜索条件是什么,返回的都是'%越野车类%'里的值
作者: love戒情人    时间: 2010-1-14 00:08
什么呀???
你这个错误可能是因为fa_class为空!!
作者: 一切还好    时间: 2010-1-14 00:08
现在情况是fa_class不为空

如果是你说的那样
那 if rs.eof and rs.bof then str="目前没有您需要的汽车类型,请重新搜索!"
这句话不起作用啊
作者: isly‖    时间: 2010-1-14 00:08
sql="select * from product where fa_class like '"&fa_class&"' order by id desc"

fa_class字段类型是什么




欢迎光临 新微赢技术网 (http://bbs.weiying.cn/) Powered by Discuz! X3.2