ASP分页显示,显示第一页,无法显示后面,请帮忙看看问题在哪里。
<!--#includefile="conn.asp"--><%class1=request.form("class1")Setrs=Server.CreateObjec...
<!--#include file="conn.asp"-->
<%
class1=request.form("class1")
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from class where classname='"&class1&"'"
rs.Open sql,conn,1,1
teacher=rs("classadmin")
rs.close
sql="select * from admin1 where class='"&class1&"' ORDER by number"
rs.Open sql,conn,1,1
if rs.recordcount=0 then
response.write "农户信息可共您查询"
else
rs.pagesize=20
if request("action")="n"then
session("page")=session("page")+1
else
if request("action")="p"then
session("page")=session("page")-1
else
if request("action")="f"then
session("page")=1
else
if request("action")="l"then
session("page")=rs.pagecount
else
if isnumeric(request("page1"))=true then
session("page")=clng(request("page1"))
else
session("page")=1
end if
end if
end if
end if
end if
if session("page")>rs.pagecount then session("page")=rs.pagecount
if session("page")<1 then session("page")=1
%>
----------------------------------------内容------------------------------
</table><table width="69%" border="1" align="center" cellpadding="2" cellspacing="2" borderColorLight=#808080 borderColorDark=#ffffff>
<tr>
<%if rs.pagecount > 0 then%>
<td width="13%" align="left">当前页<%=intpage%>/<%=rs.PageCount%></td>
<%else%>
<td width="41%" align="left">当前页0/0</td><%end if%>
<td width="46%" align="right"> <a href="studentlist.asp?page=1">首页</a>|
<%if pre then%>
<a href="studentlist.asp?page=<%=intpage -1%>">上页</a>| <%end if%>
<%if last then%>
<a href="studentlist.asp?page=<%=intpage +1%>">下页</a> |<%end if%>
<a href="studentlist.asp?page=<%=rs.PageCount%>">尾页</a>|转到第
<select name="sel_page" onchange="javascript:location=this.options[this.selectedIndex].value;">
<%
for i = 1 to rs.PageCount
if i = intpage then%>
<option value="studentlist.asp?page=<%=i%>" selected><%=i%></option>
<%else%>
<option value="studentlist.asp?page=<%=i%>"><%=i%></option>
<%
end if
next
%>
</select>页</font>
</td>
</tr>
</table></td>
</tr>
<tr>
<td height="100%" align="center" colspan="3">
<table border="0" width="650" cellspacing="0" cellpadding="0" height="25">
</table> </td>
</tr>
</table>
<%
rs.close
set rs=nothing
set conn=nothing
end if
%>
</body>
</html> 展开
<%
class1=request.form("class1")
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from class where classname='"&class1&"'"
rs.Open sql,conn,1,1
teacher=rs("classadmin")
rs.close
sql="select * from admin1 where class='"&class1&"' ORDER by number"
rs.Open sql,conn,1,1
if rs.recordcount=0 then
response.write "农户信息可共您查询"
else
rs.pagesize=20
if request("action")="n"then
session("page")=session("page")+1
else
if request("action")="p"then
session("page")=session("page")-1
else
if request("action")="f"then
session("page")=1
else
if request("action")="l"then
session("page")=rs.pagecount
else
if isnumeric(request("page1"))=true then
session("page")=clng(request("page1"))
else
session("page")=1
end if
end if
end if
end if
end if
if session("page")>rs.pagecount then session("page")=rs.pagecount
if session("page")<1 then session("page")=1
%>
----------------------------------------内容------------------------------
</table><table width="69%" border="1" align="center" cellpadding="2" cellspacing="2" borderColorLight=#808080 borderColorDark=#ffffff>
<tr>
<%if rs.pagecount > 0 then%>
<td width="13%" align="left">当前页<%=intpage%>/<%=rs.PageCount%></td>
<%else%>
<td width="41%" align="left">当前页0/0</td><%end if%>
<td width="46%" align="right"> <a href="studentlist.asp?page=1">首页</a>|
<%if pre then%>
<a href="studentlist.asp?page=<%=intpage -1%>">上页</a>| <%end if%>
<%if last then%>
<a href="studentlist.asp?page=<%=intpage +1%>">下页</a> |<%end if%>
<a href="studentlist.asp?page=<%=rs.PageCount%>">尾页</a>|转到第
<select name="sel_page" onchange="javascript:location=this.options[this.selectedIndex].value;">
<%
for i = 1 to rs.PageCount
if i = intpage then%>
<option value="studentlist.asp?page=<%=i%>" selected><%=i%></option>
<%else%>
<option value="studentlist.asp?page=<%=i%>"><%=i%></option>
<%
end if
next
%>
</select>页</font>
</td>
</tr>
</table></td>
</tr>
<tr>
<td height="100%" align="center" colspan="3">
<table border="0" width="650" cellspacing="0" cellpadding="0" height="25">
</table> </td>
</tr>
</table>
<%
rs.close
set rs=nothing
set conn=nothing
end if
%>
</body>
</html> 展开
4个回答
展开全部
你要确认的几个问题
1、intpage值怎么来的呢?
2、if request("action")="n"then
session("page")=session("page")+1
else
if request("action")="p"then
session("page")=session("page")-1
else
if request("action")="f"then
session("page")=1
else
if request("action")="l"then
session("page")=rs.pagecount
else
if isnumeric(request("page1"))=true then
session("page")=clng(request("page1"))
else
session("page")=1
end if
end if
end if
end if
end if
这些作用是什么呢?
为什么用session呢?
3、你传递页码是用session传递?还是?
1、intpage值怎么来的呢?
2、if request("action")="n"then
session("page")=session("page")+1
else
if request("action")="p"then
session("page")=session("page")-1
else
if request("action")="f"then
session("page")=1
else
if request("action")="l"then
session("page")=rs.pagecount
else
if isnumeric(request("page1"))=true then
session("page")=clng(request("page1"))
else
session("page")=1
end if
end if
end if
end if
end if
这些作用是什么呢?
为什么用session呢?
3、你传递页码是用session传递?还是?
展开全部
除了楼上说的那三个问题还有一个问题没有解决
就是class1=request.form("class1")
你要在分页时也要有传值
<a href="studentlist.asp?page=<%=intpage -1%>&class1=<%=class1%>">上页</a>
后面要添加上条件
就是class1=request.form("class1")
你要在分页时也要有传值
<a href="studentlist.asp?page=<%=intpage -1%>&class1=<%=class1%>">上页</a>
后面要添加上条件
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<%sql="select * from admin1 where class='"&class1&"' ORDER by number"
rs.Open sql,conn,1,1
if rs.recordcount=0 then
response.write "没有农户信息可共您查询"
else
rs.pagesize=20
page=""
page=cint(request("page"))
if page="" or page=0 then page=1
%>
<table width="69%" border="1" align="center" cellpadding="2" cellspacing="2" borderColorLight=#808080 borderColorDark=#ffffff>
<tr>
<%if rs.PageCoun > 0 then%>
<td width="13%" align="left">当前页<%=page%>/<%=rs.PageCount%></td>
<%else%>
<td width="41%" align="left">当前页0/0</td><%end if%>
<td width="46%" align="right"> <a href="studentlist.asp?page=1">首页</a>|
<a href="studentlist.asp?page=<%=page -1%>">上页</a>| <%end if%>
<a href="studentlist.asp?page=<%=page +1%>">下页</a> |<%end if%>
<a href="studentlist.asp?page=<%=rs.PageCount%>">尾页</a>|转到第
<select name="sel_page" onchange="javascript:location=this.options[this.selectedIndex].value;">
<%
for i = 1 to rs.PageCount
if i = page then%>
<option value="studentlist.asp?page=<%=i%>" selected><%=i%></option>
<%else%>
<option value="studentlist.asp?page=<%=i%>"><%=i%></option>
<%
end if
next
%>
</select>页</font>
</td>
</tr>
</table>
<%
rs.close
set rs=nothing
set conn=nothing
end if
%>
希望对你有帮助.
rs.Open sql,conn,1,1
if rs.recordcount=0 then
response.write "没有农户信息可共您查询"
else
rs.pagesize=20
page=""
page=cint(request("page"))
if page="" or page=0 then page=1
%>
<table width="69%" border="1" align="center" cellpadding="2" cellspacing="2" borderColorLight=#808080 borderColorDark=#ffffff>
<tr>
<%if rs.PageCoun > 0 then%>
<td width="13%" align="left">当前页<%=page%>/<%=rs.PageCount%></td>
<%else%>
<td width="41%" align="left">当前页0/0</td><%end if%>
<td width="46%" align="right"> <a href="studentlist.asp?page=1">首页</a>|
<a href="studentlist.asp?page=<%=page -1%>">上页</a>| <%end if%>
<a href="studentlist.asp?page=<%=page +1%>">下页</a> |<%end if%>
<a href="studentlist.asp?page=<%=rs.PageCount%>">尾页</a>|转到第
<select name="sel_page" onchange="javascript:location=this.options[this.selectedIndex].value;">
<%
for i = 1 to rs.PageCount
if i = page then%>
<option value="studentlist.asp?page=<%=i%>" selected><%=i%></option>
<%else%>
<option value="studentlist.asp?page=<%=i%>"><%=i%></option>
<%
end if
next
%>
</select>页</font>
</td>
</tr>
</table>
<%
rs.close
set rs=nothing
set conn=nothing
end if
%>
希望对你有帮助.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2010-08-20
展开全部
你可能没有传参数
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询