asp 代码分页,一开始是正常的!!点完下一页就全部显示出来了...
接收、关键字!!tj=request("tj")gjz=request("gjz")ifgjz<>""theniftj="techniciansignature"then...
接收、关键字!!
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>
真心求助各位大侠,有不清楚的问我,我随时在线!! 展开
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>
真心求助各位大侠,有不清楚的问我,我随时在线!! 展开
3个回答
展开全部
很简单的一个问题,因为你在选择下一页的时候,没有把你搜索的参数传到下一页中,当然会是把全部显示出来的哦。因为参数没则传,则为空,当然SQL语句就是对全部信息进行查询的
正确代码如直:
<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>
正确代码如直:
<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>
展开全部
<a href="list.asp?tj=<%=tj%>&gjz=<%=gjz%>page=<%=epage-1%>">上一页</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>
即翻页的时候你的参数也要传进去啊,要不然肯定无法取到值啊!
<%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
'分页显示,每页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
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询