接收、关键字!!
tj=request("tj")
gjz=request("gjz")
if gjz<>"" then
if tj="techniciansignature" then sql="select * from reg where techniciansignature like '%"&gjz&"%'"
if tj="customersignature" then sql="select * from reg where customersignature like '%"&gjz&"%'"
end if
搜索框:
<form action="list.asp" name="form1" method="post" style="margin:0px 30px; padding:0px; float:left;">
<input type="text" name="gjz" />
<input type="radio" name="tj" value="techniciansignature" checked="checked" />技术员
<input type="radio" name="tj" value="customersignature" />客户姓名
<input type="submit" name="qr" value="确认" />
</form>
分页代码:
rs.pagesize=10
if request("page")<>"" then
epage=cint(request("page"))
if epage<1 then epage=1
if epage>rs.pagecount then epage=rs.pagecount
else
epage=1
end if
rs.absolutepage=epage
<a href="list.asp?page=<%=epage-1%>">上一页</a>
<%for a=1 to rs.pagecount
response.Write("<a href=list.asp?page=" & a & ">[" & a & "]</a> ")
next%>
<a href="list.asp?page=<%=epage+1%>">下一页</a>
<%if request.cookies("power")="0" then%>
<a href="add.asp">添加</a>
真心求助各位大侠,有不清楚的问我,我随时在线!!
正确代码如直:
<a href="list.asp?page=<%=epage-1%>&tj=<%=tj%>&gjz=<%=gjz%>">上一页</a>
<%for a=1 to rs.pagecount
response.Write("<a href=list.asp?page=" & a &"&tj="&tj&"&gjz="&gjz&">[" & a & "]</a> ")
next%>
<a href="list.asp?page=<%=epage+1%>&tj=<%=tj%>&gjz=<%=gjz%>">下一页</a>
<%if request.cookies("power")="0" then%>
<a href="add.asp">添加</a>
<%for a=1 to rs.pagecount
response.Write("<a href=list.asp?tj="&tj&"&gjz="&gjz&"page=" & a & ">[" & a & "]</a> ")
next%>
<a href="list.asp?tj=<%=tj%>&gjz=<%=gjz%>page=<%=epage+1%>">下一页</a>
即翻页的时候你的参数也要传进去啊,要不然肯定无法取到值啊!
'分页显示,每页10个记录
MaxPerPage=10
if request("page")<>"" then
currentPage=clng(request("page"))
else
currentPage=1
end if
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sqlStr,conn,1,1
if rs.eof then
response.write"<tr><td colspan=9>还没有任何用户……</td></tr>"
else
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
Num=0
do while not rs.eof
response.Write("
Num=Num+1
if Num>=MaxPerPage then exit do
rs.movenext
loop
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
Num=0
do while not rs.eof
response.Write("
Num=Num+1
if Num>=MaxPerPage then exit do
rs.movenext
loop
else
currentPage=1
Num=0
do while not rs.eof
response.Write("<
loop
end if
end if
response.Write("<tr><td colspan=9>"&showpage(strFileName,totalput,MaxPerPage,CurrentPage,true,true,"个用户")&"</td></tr>")
end if
rs.close
set rs=nothing