求大神帮忙解决ASP+ACCESS多条件组合查询问题
我有一个多条件组合查询,条件有6个。我有两个页面,一个是chaxun.asp用表单来输入查询条件, chaxunjieguo.asp接收表单的查询条件并显示查询结果。我输入查询条件后,查询出来的是相关表里的全部内容,没有实现按条件查询,求各位大神帮忙看看问题出在哪里,拜托拜托!!下面是chaxunjieguo.asp部分代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../../Connections/link.asp" -->
<%
dim qy
qy=0
if request.form ("huiyimingcheng") <>"" then
Sql="会议名称= '%"& request.form ("huiyimingcheng") &"%'" '会议名称是Access表里的字段名
qy=qy+1
end if
if request.form ("lingyu") <>"" then
if qy=0 then
Sql= Sql & " 领域='%"& request.form ("lingyu") &" %'"
else
Sql= Sql & " and 领域='%"& request.form ("lingyu") &" %'"
end if
qy=qy+1
end if
if request.form ("changjia") <>"" then
if qy=0 then
Sql= Sql & " 厂家 like '%"& request.form ("changjia") &"%'"
else
Sql= Sql & " and 厂家 like '%"& request.form ("changjia") &"%'"
end if
qy=qy+1
end if
if request.form ("nianfen") <>"" then
if qy=0 then
Sql= Sql & " 年 like '%"& request.form ("nianfen") &"%'"
else
Sql= Sql & " and 年 like '%"& request.form ("nianfen") &"%'"
end if
qy=qy+1
end if
if request.form ("yuefen") <>"" then
if qy=0 then
Sql= Sql & " 月 like '%"& request.form ("yuefen") &"%'"
else
Sql= Sql & " and 月 like '%"& request.form ("yuefen") &"%'"
end if
qy=qy+1
end if
if request.form ("jiangzhe") <>"" then
if qy=0 then
Sql= Sql & " 讲者 like '%"& request.form ("jiangzhe") &"%'"
else
Sql= Sql & " and 讲者 like '%"& request.form ("jiangzhe") &"%'"
end if
qy=qy+1
end if
Sql= "Select * from T会议表 where 1=1"
set rs=link.Execute(Sql)
%>
<%
Dim huiyichaxun
Dim huiyichaxun_numRows
Set huiyichaxun = Server.CreateObject("ADODB.Recordset")
huiyichaxun.ActiveConnection = MM_link_STRING
huiyichaxun.Source = "SELECT * FROM [T会议表]"
huiyichaxun.CursorType = 0
huiyichaxun.CursorLocation = 2
huiyichaxun.LockType = 1
huiyichaxun.Open()
huiyichaxun_numRows = 0
%>