我是这样分的, PageCount=0 sql="select * from proj_info where projyear like '"& pyear &"' and ifshenhe3 like '"& tongguo &"' and projname like '%%"& pname &"%%' and entername like '"& uname &"' and usercode like '"& ucity &"' and projsort like '"& psort &"' and ifshenhe1 like '"& ifsh1 &"' order by id" set rs=conn.execute(sql) while not rs.eof PageCount=PageCount+1 rs.movenext wend sql="select * from proj_info where projyear like '"& pyear &"' and ifshenhe3 like '"& tongguo &"' and projname like '"& pname &"' and entername like '"& uname &"' and usercode like '"& ucity &"' and projsort like '"& psort &"' and ifshenhe1 like '"& ifsh1 &"' order by id" set rs=server.createobject("adodb.recordset") rs.open sql,conn,3,2 on error resume next
PageSize =15 PageCount=(PageCount+PageSize-1)\PageSize Page = CLng(Request("Page")) '分页显示 If not Page >1 Then Page = 1 If Page > PageCount Then Page = PageCount i=page+(page-1)*14 rs.AbsolutePage = Page For iPage = 1 To PageSize %> <tr height="30"> <td><div align="center"><%=i%></div></td> <td><div align="center"><%=rs("projyear")%></div></td> <td width="220"><%=rs("entername")%></td> <td width="220"><%=rs("projname")%></td> <td><div align="center"><%=rs("projsort")%></div></td> <td><div align="center"><%=rs("shenqsum")%></div></td> <td><div align="center"><%=rs("cpifusum")%></div></td> <td><div align="center"><%=rs("ppifusum")%></div></td> <td><div align="center"><%=rs("city")%></div></td> </tr> <% rs.MoveNext If rs.EOF Then Exit For i=i+1 Next %> </table> <div ALIGN="right"> <table> <form ACTION="<%=Myself%>?ifsh1=<%=ifsh1%>&pyear=<%=pyear%>&pname=<%=pname%>&tongguo=<%=tongguo%>&uname=<%=uname%>&ucity=<%=ucity%>&psort=<%=psort%>%>" METHOD="GET"><tr><td><p></td> </tr> <td> <p ALIGN="right"><%If Page <> 1 Then ' 如果不是位于第一页%> <a href="<%=Myself%>?Page=1&ifsh1=<%=ifsh1%>&pyear=<%=pyear%>&pname=<%=pname%>&tongguo=<%=tongguo%>&uname=<%=uname%>&ucity=<%=ucity%>&psort=<%=psort%>"> 第一页</a> <a HREF="<%=Myself%>?Page=<%=(Page-1)%>&ifsh1=<%=ifsh1%>&pyear=<%=pyear%>&pname=<%=pname%>&tongguo=<%=tongguo%>&uname=<%=uname%>&ucity=<%=ucity%>&psort=<%=psort%>"> 上一页</a> <%End If If Page <> PageCount Then ' 如果不是位于最后一页 %> a HREF="<%=Myself%>?Page=<%=(Page+1)%>&ifsh1=<%=ifsh1%>&pyear=<%=pyear%>&pname=<%=pname%>&tongguo=<%=tongguo%>&uname=<%=uname%>&ucity=<%=ucity%>&psort=<%=psort%>"> 下一页</a> <a HREF="<%=Myself%>?Page=<%=PageCount%>&ifsh1=<%=ifsh1%>&pyear=<%=pyear%>&pname=<%=pname%>&tongguo=<%=tongguo%>&uname=<%=uname%>&ucity=<%=ucity%>&psort=<%=psort%>"> 最后一页</a> <% End If %> </p> </td> </tr> </table>