ASP+ACCESS页面建立模糊查询
<!--#includefile="Conn.asp"--><!--#includefile="Common.asp"--><%%><html><head><tr><td...
<!--#include file="Conn.asp"-->
<!--#include file="Common.asp"-->
<%
%>
<html>
<head>
<tr>
<td align="center"> 工作描述:
<input name="Works_title" type="text" id="Works_title" value="" size="100">
<input type="submit" name="Submit" value="模糊查询" onClick="return checktxm();" />
</td>
</tr>
</table>
<br>
<%
dim totalPut
dim CurrentPage
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
const Max=20
works_stat=request("works_stat")
if works_stat="" then
nworks_stat=""
else
nworks_stat = "works_stat = '"&works_stat&"' and "
end if
works_statu=request("works_statu")
if works_statu="" then
nworks_statu=""
else
nworks_statu = "works_statu = '"&works_statu&"' and "
end if
sql= "select * from Works_Info where "&nworks_stat&nworks_statu&" x=1 order by Works_Id desc"
Rs.Open Sql,Conn,1,1
if Rs.eof and Rs.bof then
response.write("<br><br>暂时还没有任何工作信息!")
else
totalPut=Rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*Max>totalput then
if (totalPut mod Max)=0 then
currentpage= totalPut \ Max
else
currentpage= totalPut \ Max + 1
end if
end if
Rs.close
set Rs = nothing
end if
sub showContent
dim i
i=0
%>
..........
</body>
</html>
以上是我本页的一部分代码,查询框已建立,还要再做什么才能在本页实现关于字段Works_title的模糊查询?
求大神指导 展开
<!--#include file="Common.asp"-->
<%
%>
<html>
<head>
<tr>
<td align="center"> 工作描述:
<input name="Works_title" type="text" id="Works_title" value="" size="100">
<input type="submit" name="Submit" value="模糊查询" onClick="return checktxm();" />
</td>
</tr>
</table>
<br>
<%
dim totalPut
dim CurrentPage
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
const Max=20
works_stat=request("works_stat")
if works_stat="" then
nworks_stat=""
else
nworks_stat = "works_stat = '"&works_stat&"' and "
end if
works_statu=request("works_statu")
if works_statu="" then
nworks_statu=""
else
nworks_statu = "works_statu = '"&works_statu&"' and "
end if
sql= "select * from Works_Info where "&nworks_stat&nworks_statu&" x=1 order by Works_Id desc"
Rs.Open Sql,Conn,1,1
if Rs.eof and Rs.bof then
response.write("<br><br>暂时还没有任何工作信息!")
else
totalPut=Rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*Max>totalput then
if (totalPut mod Max)=0 then
currentpage= totalPut \ Max
else
currentpage= totalPut \ Max + 1
end if
end if
Rs.close
set Rs = nothing
end if
sub showContent
dim i
i=0
%>
..........
</body>
</html>
以上是我本页的一部分代码,查询框已建立,还要再做什么才能在本页实现关于字段Works_title的模糊查询?
求大神指导 展开
2个回答
展开全部
if works_statu="" then
nworks_statu=""
else
nworks_statu = " works_statu like '%"&request("works_statu")&"%' and "
end if
sql= "select * from Works_Info where "&nworks_stat&" x=1 order by Works_Id desc"
nworks_statu=""
else
nworks_statu = " works_statu like '%"&request("works_statu")&"%' and "
end if
sql= "select * from Works_Info where "&nworks_stat&" x=1 order by Works_Id desc"
更多追问追答
追问
加在哪里?
追答
你原来的是
works_stat=request("works_stat")
if works_stat="" then
nworks_stat=""
else
nworks_stat = "works_stat = '"&works_stat&"' and "
end if
works_statu=request("works_statu")
if works_statu="" then
nworks_statu=""
else
nworks_statu = "works_statu = '"&works_statu&"' and "
end if
sql= "select * from Works_Info where "&nworks_stat&nworks_statu&" x=1 order by Works_Id desc"
替换这些
2015-03-13
展开全部
貌似没看到你使用 like 查询啊 ?
更多追问追答
追问
就是不会啊,所以才问!
追答
看楼上的即可。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询