想做一个综合查询:环境asp

来源:百度知道 编辑:UC知道 时间:2024/05/24 14:12:30
好几个条件,每个都可以为空,怎样根据用户提交的内容构造对应的sql语句?使用排列组合?这样太麻烦了 有什么好的解决方法吗谢谢
比如这里的http://www.class.com.cn/scrp/booksearch.cfm
想知道在后台是如何根据条件构造sql的
感谢 飞天武 我也是这么想的 但是这样的and怎么加上
非常感谢大家我已经想出方法了
---------------------------
并且写了一个生产构造sql程序的程序
放在我的blog上了
www.buycode.net

if request.form("a1")<>" " then
zdstr="a1="&request.form("a1")
else
if request.form("a2")<>" " then ....
else ....zdstr=zdstr+"a2="&...
end if
end if
sql="select * from table where "&zdstr
上面的有问题 但是希望给你点启发 用if else if end id 或 for
do while 循环 祝你成功