高分求助 关于一句数据库命令 一加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' 中。
展开
 我来答
贴骑
2008-07-27 · TA获得超过227个赞
知道小有建树答主
回答量:122
采纳率:0%
帮助的人:0
展开全部
你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 "
百度网友e4336295a
2008-07-27 · 超过13用户采纳过TA的回答
知道答主
回答量:69
采纳率:0%
帮助的人:71.1万
展开全部
楼上正解。

Select * from TableName Where ID=XX Order by ID;

按这个格式就对了
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
猫那个咪
2008-07-28
知道答主
回答量:63
采纳率:0%
帮助的人:0
展开全部
正确答案已经写出来了,贴骑的就是,order by要在where语句后面的
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式