<%
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
问题还没解决,不过多谢各位高手的指导作者: ▄愛變鎖ゞ 时间: 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
如果是你说的那样
那 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"