请问下面这句代码那里有问题?为什么总是提示ORDER附近有错误呢?
set rsp = server.CreateObject( "adodb.recordset ")
if IsNumeric(categoryid) then
sql= "select * from product where categoryid = "&categoryid& " order by id desc "
else
sql= "select * from product order by id desc "
end if
rsp.Open sql,conn,1,1
------解决方案--------------------1、判断categoryid是否有值
if categoryid= " " or isnull(categoryid)then categoryid=0
2、确认有ID这个字段
------解决方案--------------------应该这样:
set rsp = server.CreateObject( "adodb.recordset ")
if categoryid <> " " then
if IsNumeric(categoryid) then
sql= "select * from product where categoryid = "&categoryid& " order by id desc "
else
sql= "select * from product order by id desc "
end if
end if
rsp.Open sql,conn,1,1