展开全部
刚好有个相似的,改动改动发给你!
search.asp:
| ||||||||||||||||
————————————————————
show.asp:
dim bname,btype,pname,ptype,aname,atype,mname,mtype,continue,currentpage,rowcount,i
continue=0
currentpage=Trim(Request("gopage"))
If currentpage="" then currentpage=1
bname=Trim(Request("bookname"))
btype=Trim(Request("booktype"))
pname=Trim(Request("publisher"))
ptype=Trim(Request("pubtype"))
aname=Trim(Request("author"))
atype=Trim(Request("auttype"))
mname=Trim(Request("money"))
mtype=Trim(Request("moneytype"))
IF bname="" and pname="" and aname="" and mname="" then Response.Redirect "请填入信息!"
mySQL="select * from aa where "
IF bname<>"" then
IF btype=1 then
mySQL=mySQL & "姓名='" & bname & "'"
continue=1
else
mySQL=mySQL & "姓名 like '%" & bname & "%'"
continue=1
End IF
End IF
IF pname<>"" then
IF continue=1 then mySQL=mySQL & "and "
IF ptype=1 then
mySQL=mySQL & "身份证号='" & pname & "'"
continue=1
else
mySQL=mySQL & "身份证号 like '%" & pname & "%'"
continue=1
End IF
End IF
IF aname<>"" then
IF continue=1 then mySQL=mySQL & "and "
IF atype=1 then
mySQL=mySQL & "参加工作日期='" & aname & "'"
else
mySQL=mySQL & "参加工作日期 like '%" & aname & "%'"
End IF
End IF
IF mname<>"" then
IF continue=1 then mySQL=mySQL & "and "
IF mtype=1 then
mySQL=mySQL & "基本工资='" & mname & "'"
else
mySQL=mySQL & "基本工资 like '%" & mname & "%'"
End IF
End IF
%>
![]() | ||||
Set Con=Server.CreateObject("ADODB.Connection") con.Open "DSN=xhnew.mdb;DBQ=D:\..\xhnew.mdb;DriverId=25;FIL=MSAccess;MaxBufferSize=2048;" set RS=Server.CreateObject("ADODB.RecordSet") RS.Open mySQL,Con,adOpenStatic RS.PageSize=15 IF not RS.EOF then RS.AbsolutePage=cInt(currentpage) rowcount=0 While not RS.EOF and rowcount year1=Year(RS("参加工作日期")) month1=Month(RS("参加工作日期")) day1=Day(RS("参加工作日期")) %> | ||||
rowcount=rowcount+1
RS.MoveNext
Wend
For i=rowcount+1 to RS.PageSize
%>
Next
%>
第
Response.write(currentpage)
%>
页/
共
IF RS.PageCount>0 then
Response.write(RS.PageCount)
else
Response.write("1")
End IF
%>
页
dim prepage,nextpage
prepage=cInt(currentpage)-1
nextpage=cInt(currentpage)+1
IF cInt(currentpage)>1 then
Response.write("上一页" )
else
Response.write("上一页")
End IF
%>
IF cInt(currentpage)
Response.write("下一页" )
else
Response.write("下一页")
End IF
Con.Close
set RS=NOTHING
%>
关闭窗口
没人喜欢做问答题,谁都喜欢做选择题!要自己勤动手!

已赞过
已踩过<
你对这个回答的评价是?
评论
收起
本文详细解析了一段ASP代码,该代码用于从数据库中检索信息,并展示了如何通过不同的搜索条件来定制查询。介绍了如何使用变量构造SQL查询语句,以及如何处理页面跳转和分页显示等功能。

592

被折叠的 条评论
为什么被折叠?



