刚学asp,以下代码中诚求模糊查询与条件查询
初接触asp,以下添加什么代码来实现模糊查询和合同时间、所属分公司的查询,请高手看看还有哪里有错误的地方<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<link rel="stylesheet" href="css/css.css">
<title>办公系统</title>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
</head>
<body bgcolor="#eeeeee" topmargin="5" leftmargin="5">
<%
call bghead()
%>
<center>
<table>
<tr>
<td><b> 档案合同目录</b> </td>
</tr>
</table>
</center>
<center>
</center>
<%
call bgmid()
%>
<tr>
<td width="76%" align="right">
合同查询:
<%
sql="select * from newnoticed order by id"
set rs_newnoticed=conn.execute(sql)
%>
<select name="newnoticed" onChange="form2.submit()">
<option value="">所有分公司</option>
<%
do while rs_suoshugongsi.eof=false
%>
<option value="<%=rs_suoshugongsi("id")%>"<%if trim(cstr(rs_suoshugongsi("id")))=nowsuoshugongsi then%> selected="selected"<%end if%>><%=rs_suoshugongsi("suoshugongsi")%></option>
<%
rs_ku.movenext
loop
%>
</select>
<%
sql="select * from hetongshijian order by id"
set rs_hetongshijian=conn.execute(sql)
%>
<select name="hetongshijian" onChange="form2.submit()">
<option value="">所有时间</option>
<%
do while rs_hetongshijian.eof=false
%>
<option value="<%=rs_hetongshijian("id")%>"<%if trim(cstr(rs_hetongshijian("id")))=nowhetongshijian then%> selected="selected"<%end if%>><%=rs_hetongshijian("hetongshijian")%></option>
<%
rs_hetongshijian.movenext
loop
%>
</select>
<input type="text" name="keyword" size="20" value="<%=nowkeyword%>">
<input type="submit" value=" 查询 ">
<center>
<%
set conn=opendb("oabusy","conn","accessdsn")
Set rs=Server.CreateObject("ADODB.recordset")
sql="select * from newnoticed order by id desc"
'if request("lookfor")="yes" then sql="select * from newnoticed where hetongshijian between " & "#" & hetongshijian & "# and #" & hetongshijian1 & "# order by id desc"
if request("lookfor")="yes" then sql="select * from newnoticed where hetongshijian between " & hetongshijian & " and " & hetongshijian1 & " order by id desc"
rs.open sql,conn,1
if not rs.eof and not rs.bof then
rs.pagesize=20
page=clng(request("page"))
if page<1 then page=1
if page>rs.pagecount then page=rs.pagecount
href="noticelookd.asp"
rs.absolutepage=page
%>
<br>
<form method="post" action="<%=href%>?page=<%=page%>">
<table border="1" cellpadding="0" cellspacing="0" width="1033">
<tr>
<td width="60" height="31" align=center><b>所属公司</b></td>
<td width="59" align=center><b>合同名称</b></td>
<td width="69" align=center><b>附件</b></td>
<td width="59" align=center><b>建档日期</b></td>
<td width="61" align=center><b>合同编号</b></td>
<td width="61" align=center><b>甲方单位</b></td>
<td width="87" align=center><b>乙方单位</b></td>
<td width="77" align=center><b>服务项目</b></td>
<td width="64" align=center><b>地点/面积</b></td>
<td width="53" align=center><b>合同金额</b></td>
<td width="54" align=center><b>收/付</b></td>
<td width="69" align=center><b>合同起止期</b></td>
<td width="54" align=center><b>合同状态</b></td>
<td width="78" align=center><b>收/付日期</b></td>
<td width="96" align=center><b>备注</b></td>
</tr>
<%
for ipage=1 to rs.pagesize
%>
<tr>
<td align="center" width=60><%=rs("suoshugongsi")%></td>
<td align="center" width=59><%=rs("title")%></td>
<td align="center">
<%
if rs("filename")<>"" then
%>
<a href="listnoticefile.asp?id=<%=rs("id")%>" target="_blank"><img src="images/attach.gif" width=30 height=30 border=0 alt="文件名:<%=rs("filename")%>"></a>
<%
else
%>
<%
end if
%>
</td>
<td align="center" width=59><%=rs("noticedate")%></td>
<td align="center" width=61><%=rs("hetongpianhao")%></td>
<td align="center" width=61><%=rs("jiafangdanwei")%></td>
<td align="center" width=87><%=rs("yifangdanwei")%></td>
<td align="center" width=77><%=rs("fuwuxianmu")%></td>
<td align="center" width=64><%=rs("didianmianji")%></td>
<td align="center" width=53><%=rs("hetongjinge")%></td>
<td align="center" width=54><%=rs("shoufu")%></td>
<td align="center" width=69><%=rs("hetongshijian")%></td>
<td align="center" width=54><%=rs("hetongzhantai")%></td>
<td align="center" width=78><%=rs("shoufuriqing")%></td>
<td align="center" width=96><%=rs("beizhu")%></td>
</tr>
<%
rs.movenext
if rs.eof then exit for
next
%>
</table>
<input type="hidden" name="myyear" value="<%=myyear%>">
<input type="hidden" name="mymonth" value="<%=mymonth%>">
<input type="hidden" name="lookfor" value="<%=request("lookfor")%>">
<input type="hidden" name="page" value="<%=page%>">
</form>
<table border=0 width=550>
<tr><form action=<%=href%> method=get>
<td align="center">
<%
response.write "<a href=" & href & "?page=1&myyear=" & server.urlencode(myyear) & "&mymonth=" & server.urlencode(mymonth) & "&lookfor=" & server.urlencode(request("lookfor")) & ">第一页</a>"
%>
</td>
<td align="center">
<%
response.write "<a href=" & href & "?page=" & (page-1) & "&myyear=" & server.urlencode(myyear) & "&mymonth=" & server.urlencode(mymonth) & "&lookfor=" & server.urlencode(request("lookfor")) & ">上一页</a>"
%>
</td>
<td align="center">
<%
response.write "<a href=" & href & "?page=" & (page+1) & "&myyear=" & server.urlencode(myyear) & "&mymonth=" & server.urlencode(mymonth) & "&lookfor=" & server.urlencode(request("lookfor")) & ">下一页</a>"
%>
</td>
<td align="center">
<%
response.write "<a href=" & href & "?page=" & rs.pagecount & "&myyear=" & server.urlencode(myyear) & "&mymonth=" & server.urlencode(mymonth) & "&lookfor=" & server.urlencode(request("lookfor")) & ">最后一页</a>"
%>
</td>
<td align="center">
去第<input type=text name=page size=3>页</td>
<input type="hidden" name="myyear" value="<%=myyear%>">
<input type="hidden" name="mymonth" value="<%=mymonth%>">
<input type="hidden" name="lookfor" value="<%=request("lookfor")%>">
<td align="center">第<%=page%>/<%=rs.pagecount%>页</td></form></tr></table><br>
<%
else
%>
<br><br><br>
<table border="0" cellpadding="0" cellspacing="0" width="400">
<tr>
<td width="400" align="center"><font size="4" color="red">对不起,没有相关纪录</font></td></tr></table>
<%
end if
%>
</center>
<%
call bgback()
%>
</body>
</html>