请问这个如何实现多个搜索,想了两天,不知道该怎么安排

sea216 2007-09-26 04:14:31
代码:
Set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = MM_conn_STRING
if Session("LevelChonst0")="" Then
sql = "SELECT * FROM Co_Info where [Area] = '"&Session("LevelChonst0")&"' OR [Area] = '"&Session("LevelChonst1")&"' OR [Area] = '"&Session("LevelChonst2")&"' OR [Area] = '"&Session("LevelChonst3")&"' OR [Area] = '"&Session("LevelChonst4")&"' OR [Area] = '"&Session("LevelChonst5")&"' OR [Area] = '"&Session("LevelChonst6")&"' OR [Area] = '"&Session("LevelChonst7")&"'"

if act = "sear" then

if Co_id <> "" then
sql = " SELECT * FROM Co_Info where Co_id like '%" & Co_id & "%'"
end if
if Co_Name <> "" then
sql = " SELECT * FROM Co_Info where Co_Name like '%" & Co_Name & "%'"
end if
if Co_Manager <> "" then
sql = " SELECT * FROM Co_Info where Co_Manager like '%" & Co_Manager & "%'"
end if
if Co_Tel <> "" then
sql = " SELECT * FROM Co_Info where Co_Tel like '%" & Co_Tel & "%'"
end if
if Co_handset <> "" then
sql = " SELECT * FROM Co_Info where Where Co_handset like '%" & Co_handset & "%'"
end if
if Area <> "" then
sql = " SELECT * FROM Co_Info where Area like '%" & Area & "%'"
end if

end if
sql = sql & " ORDER BY Add_Time DESC"
...全文
73 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
sea216 2007-09-26
  • 打赏
  • 举报
回复
辛苦了
Go 旅城通票 2007-09-26
  • 打赏
  • 举报
回复

sql=sql& " and area in( '"&Session("LevelChonst0")&"', '"&Session("LevelChonst1")&"', '"&Session("LevelChonst2")&"', '"&Session("LevelChonst3")&"', '"&Session("LevelChonst4")&"', '"&Session("LevelChonst5")&"', '"&Session("LevelChonst6")&"', '"&Session("LevelChonst7")&"')"
sea216 2007-09-26
  • 打赏
  • 举报
回复
如果按照上面兄弟的方法,是可以的,但是我无法实现在后台划分区域的问题,上面的sql = "SELECT * FROM Co_Info where [Area] = '"&Session("LevelChonst0")&"' OR [Area] = '"&Session("LevelChonst1")&"' OR [Area] = '"&Session("LevelChonst2")&"' OR [Area] = '"&Session("LevelChonst3")&"' OR [Area] = '"&Session("LevelChonst4")&"' OR [Area] = '"&Session("LevelChonst5")&"' OR [Area] = '"&Session("LevelChonst6")&"' OR [Area] = '"&Session("LevelChonst7")&"'"的代码是实现划分区域的,请高手帮忙
Go 旅城通票 2007-09-26
  • 打赏
  • 举报
回复
sql = " SELECT * FROM Co_Info where 1=1 "

if act = "sear" then

if Co_id <> "" then
sql = sql&" and Co_id like '%" & Co_id & "%'"
end if
if Co_Name <> "" then
sql = sql&" and Co_Name like '%" & Co_Name & "%'"
end if
if Co_Manager <> "" then
sql = sql&" and Co_Manager like '%" & Co_Manager & "%'"
end if
if Co_Tel <> "" then
sql =sql&" and Co_Tel like '%" & Co_Tel & "%'"
end if
if Co_handset <> "" then
sql = sql&" and Co_handset like '%" & Co_handset & "%'"
end if
if Area <> "" then
sql = sql&" and Area like '%" & Area & "%'"
end if

end if
sea216 2007-09-26
  • 打赏
  • 举报
回复
if Session("LevelChonst0")="" Then,这个语句是多余的,不需要的,谢谢
sea216 2007-09-26
  • 打赏
  • 举报
回复
现在只能实现单个搜索,我要实现多个搜索,谢谢大家帮忙

28,391

社区成员

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

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