余志国网站设计工作室是专业从事义乌网站建设、义乌外贸网站建设、义乌网站制作、义乌网站设计的专业义乌网站建设工作室,是义乌外贸网站建设专家!

asp多条件查询sql语句用法,可用于搜索、筛选模块

分类:程序开发 Tags: asp 评论:0 浏览:2416 最近更新时间:2006/12/2 20:15:18

多条件查询sql语句用法,比较不错的多条件查询asp代码写法,很实用,也很简洁。
 
  1. big_id=trim(request("big_id"))
  2. small_id=trim(request("small_id"))
  3. key=trim(request("key"))
  4. yongtu=trim(request("yongtu"))
  5. chudian=trim(request("chudian"))
  6. dianliu=trim(request("dianliu"))
  7. dianya=trim(request("dianya"))
  8.  
  9.  
  10. Set Rs=Server.CreateObject("ADODB.Recordset")
  11.     
  12. sql="select * from yuzhiguo_products where 1=1"
  13.  
  14. if big_id<>"" then sql=sql&" and big_id="&big_id&""
  15.  
  16. if small_id<>"" then sql=sql&" and small_id="&small_id&""
  17.  
  18. if yongtu<>"" then sql=sql&" and yongtu="&yongtu&""
  19.  
  20. if chudian<>"" then sql=sql&" and chudian="&chudian&""
  21.  
  22. if dianliu<>"" then sql=sql&" and dianliu="&dianliu&""
  23.  
  24. if dianya<>"" then sql=sql&" and dianya="&dianya&""
  25.  
  26. if key<>"" then sql=sql&" and ( e_cpmc like '%"&key&"%') "
  27.  
  28. sql=sql&" order by "&paixu&" desc,id desc"

本文地址:/93/
  • 相关文章
  • 推荐文章
  • 最新文章
发表评论





您的IP:18.97.14.91,来自:

留言

 


免费咨询
建站咨询热线
15967985565
QQ: 358758308 Skype: yuzhiguo Facebook: yuzhiguo Email