日期:2014-05-17  浏览次数:20816 次

高手幫忙解決個分頁錯誤問題.謝謝
<%@   Language=VBScript   %>
<HTML>
<HEAD>
</HEAD>
<body>
<%
dim   conn,rs
set   conn=server.CreateObject( "ADODB.Connection ")
dsn= "provider=sqloledb.1;date   source=172.33.44.55;initial   catalog=qll;user   id=sa;password=123456 "
conn.Open   dsn
set   rs=server.CreateObject( "ADODB.Recordset ")
sql= "select   *   from   [bb] "
rs.Open   sql,conn
%>
<%
rs.PageSize=6
Page=Clng(Request( "PageText "))
if   Page <1   then   Page=1
if   Page> rs.PageCount   then   Page=rs.PageCount
ShowPage   rs,Page
%> <br> <br> <br>

<div   align= "center ">
<form   action= "aa.asp "   method= "get ">
<%
        if   Page   <>   1   then
    Response.Write " <a   href=web.index.asp?PageText=1> 第一頁 </a> "
      Response.Write " <a   href=web.index.asp?PageText= "&(Page-1)& "> 上一頁 </a> "
end   if
if   Page <> rs.PageCount   then
Response.Write " <a   href=web.index.asp?PageText= "&(Page+1)& "> 下一頁 </a> "
Response.Write " <a   href=web.index.asp?PageText= "&rs.PageCount& "> 最后一頁 </a> "
end   if

%>
<p> 輸入頁號: <input   type= "text "   name= "PageText "   size= "3 "   ID= "Text1 "> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   總頁數: <font   color= "red "> <%=Page%>
/ <%=rs.PageCount%> </font> </p>

<%
Sub   ShowPage(rs,Page)
Response.Write " <Center> <Table   border=1> "
Response.Write " <tr   bgcolor=red> "
For   i=0   to   rs.Fields.Count-1
Response.Write " <td> "&rs.Fields(i).Name& " </td> "
NEXT
Response.Write " </tr> "
for   i=1   to   rs.PageSize
Response.Write " <tr> "
for   j=0   to   rs.Fields.Count-1
Response.Write " <td> "&   rs.Fields(j).Value& " </td> "
next
Response.Write " </tr> "
rs.MoveNext
if   rs.EOF   then   exit   for
next
Response.Write " </Table> </center> "
end   sub
%>
<%
conn.Close
set   conn=nothing
%>
</form>
</div>
</body>
</HTML>
每頁的記錄是6
但是我大于6條記錄時它還是只有一個頁面
不顯示下一頁和最后一頁
請問錯在哪里?
請高手幫忙.

------解决方案--------------------
if Page> rs.PageCount then Page=rs.PageCount
下面加上
rs.AbsolutePage = Page

------解决方案--------------------
需要改两个地方:
1.if Page> rs.PageCount then Page=rs.PageCount
下面加上
rs.AbsolutePage = Page
2. <form action= "aa.asp " method= "get ">
里边的aa.asp改成web.index.asp,因为是提交到当前页面
------解决