
高分求助 关于一句数据库命令 一加order by就出错
strsql="select*frompro_list"ifpro_type<>0thenstrsql=strsql&"wherepro_type="&pro_typee...
strsql="select * from pro_list "
if pro_type<>0 then
strsql=strsql&" where pro_type="&pro_type
end if
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn, 1, 1
原来市这样的 一切正常 但改成strsql="select * from pro_list order by id" 就出错了 提示语法错误 (操作符丢失) 在查询表达式 'id where pro_type=41' 中。 展开
if pro_type<>0 then
strsql=strsql&" where pro_type="&pro_type
end if
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn, 1, 1
原来市这样的 一切正常 但改成strsql="select * from pro_list order by id" 就出错了 提示语法错误 (操作符丢失) 在查询表达式 'id where pro_type=41' 中。 展开
3个回答
展开全部
你order by id应放在where语句的后面
你输出strsql看看 response.write strsql
应改为:
strsql="select * from pro_list "
if pro_type<>0 then
strsql=strsql&" where pro_type="&pro_type
end if
strsql=strsql&" order by id "
你输出strsql看看 response.write strsql
应改为:
strsql="select * from pro_list "
if pro_type<>0 then
strsql=strsql&" where pro_type="&pro_type
end if
strsql=strsql&" order by id "
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询