查找出了问题!帮帮我!

1007 2005-04-07 07:05:17

大家帮我看一下 下边的 程序 那里出错! 如果我不选择 条件的话!没有问题 选择了

条件就出错!帮帮忙! 

sql="select * from y_yf where 1=1 order by id desc"

if id<>"" then
sql=sql & " and id=" & id
end if
if ycity<>"不限" then
sql=sql & " and ycity='" & ycity & "'"
end if
if ystyle<>"不限" then
sql=sql & " and ystyle='" & ystyle &"'"
end if
if ymoney<>"不限" then
sql=sql & " and ymoney between " & replace(ymoney,"-"," and ")
end if
if yarea<>"不限" and isnumeric(yarea) then
tmp=cint(yarea)
if tmp>=6 then
sql=sql & " and yarea>=200"
else
sql=sql & " and yarea between " & (tmp-1)*40 & " and " & tmp*40
end if
end if
rs.open sql,cn,3,2
if rs.eof and rs.bof then


————————————

错误提示!
——————————————————————

Microsoft JET Database Engine 错误 '80040e14'

ORDER BY 子句语法错误。

/web_site/new/g_yfcha_ok.asp,行67


...全文
109 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
richwong 2005-04-08
  • 打赏
  • 举报
回复
同意楼上
1007 2005-04-08
  • 打赏
  • 举报
回复
谢谢各位!特别是 "myvicy"
kkkbs 2005-04-08
  • 打赏
  • 举报
回复
Up
街头小贩 2005-04-08
  • 打赏
  • 举报
回复
偶同意: myvicy(在线解决:你的问题我来解决(因为我不会骗人,所以我最)
的作法

spec_lc 2005-04-07
  • 打赏
  • 举报
回复
嗯,order by要放到where的后面
myvicy(在线解决:你的问题我来解决(因为我不会骗人,所以我最) 说的对
cncca 2005-04-07
  • 打赏
  • 举报
回复
order by 不能房在条件后.
yestoyes 2005-04-07
  • 打赏
  • 举报
回复
学习
mayi545 2005-04-07
  • 打赏
  • 举报
回复
up
myvicy 2005-04-07
  • 打赏
  • 举报
回复
sql_order=" order by id desc"
sql="select * from y_yf where 1=1"

if id<>"" then
sql=sql & " and id=" & id
end if
if ycity<>"不限" then
sql=sql & " and ycity='" & ycity & "'"
end if
if ystyle<>"不限" then
sql=sql & " and ystyle='" & ystyle &"'"
end if
if ymoney<>"不限" then
sql=sql & " and ymoney between " & replace(ymoney,"-"," and ")
end if
if yarea<>"不限" and isnumeric(yarea) then
tmp=cint(yarea)
if tmp>=6 then
sql=sql & " and yarea>=200"
else
sql=sql & " and yarea between " & (tmp-1)*40 & " and " & tmp*40
end if
end if
sql=sql+sql_order
'这里再组合order
rs.open sql,cn,3,2
if rs.eof and rs.bof then

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧