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

SOS,asp分页出问题,求asp开发的朋友大神指点感激不尽!!!
<%'开始分页
Const MaxPerPage=8 
  dim totalPut  
  dim CurrentPage
  dim TotalPages
  dim j
  dim sql
  if Not isempty(request("page")) then
  currentPage=Cint(request("page"))
  else
  currentPage=1
  end if 
if nclassid="" then
set rs=server.CreateObject("adodb.recordset")
rs.open "select top 20 bookid,bookname,bookzz,bookchuban,shichangjia,huiyuanjia,dazhe,bookdate,bookpic from shop_books order by adddate desc",conn,1,1
else
set rs=server.CreateObject("adodb.recordset")
rs.open "select bookid,bookname,bookzz,bookchuban,shichangjia,huiyuanjia,dazhe,bookdate,bookpic from shop_books where nclassid="&nclassid&" order by adddate desc",conn,1,1 
end if
 
if err.number<>0 then
response.write "数据库中无数据"
end if

  if rs.eof And rs.bof then
  Response.Write "<p align='center' class='contents'> 对不起,此分类暂时还没有商品!</p>"
  else

do while not rs.eof and rs.bof

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
  showContent
  showpage totalput,MaxPerPage,"index.asp"
  else
  if (currentPage-1)*MaxPerPage<totalPut then
  rs.move (currentPage-1)*MaxPerPage
  dim bookmark
  bookmark=rs.bookmark
  showContent
  showpage totalput,MaxPerPage,"index.asp"
  else
currentPage=1
  showContent
  showpage totalput,MaxPerPage,"index.asp"
end if
end if
 
 

  sub showContent()
  dim i
i=0

do while not rs.eof%>
  <table width="820" border="0" cellspacing="0" cellpadding="0">
   
  <tr> 
  <td>
   

  <table width="96%" border="0" align="center" cellpadding="3" cellspacing="0">
  <tr>
 
 
  <td width="17%" valign="top">
  <table width="65" height="96" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
  <tr>
  <td bgcolor="#FFFFFF"><%
  response.Write "<a href=book.asp?id="&rs("bookid")&">"
  if trim(rs("bookpic"))<>"" then
  response.Write "<img src="&trim(rs("bookpic"))&am