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

超急!!!!分页问题,为什么我的代码,前一页,后一页,首页都没有问题,到最后一页就出错了
超急!!!!分页问题,为什么我的代码,前一页,后一页,首页都没有问题,到最后一页就出错了.
代码如下:
NewsType=request.querystring( "NewsType ")
'读取新闻资料,并分页显示在网页上
Set   rst=   Server.CreateObject( "ADODB.Recordset ")
csql= "select   *   from   News   where   NewsType= "&SqlValue(NewsType)& "   order   by   NewsID   DESC "
Rst.open   csql,conn2,1,1
if   rst.eof   then     '如果记录为空则执行相关操作,暂空
show   " <br> <br> <br> <div   align= " "center " "> 暂无新闻,敬请期待! </div> "
response.end
rst.close
set   rst=nothing
else
rst.pagesize=pgsize
pgcount=rst.pagecount
'初始化当前页
if   trim(request.querystring( "page "))= " "   or   not   isnumeric(trim(request.querystring( "page ")))   then
page=1
else
page=cint(trim(request.querystring( "page ")))
if   page <0   then   page=1
if   page> pgcount   then   page=pgcount
end   if
rst.AbsolutePage=page     '设置当前页

i=1
show   " <table   width= " "98% " "     border= " "0 " "   cellspacing= " "2 " "   cellpadding= " "0 " "> "
do   while   not   rst.eof   and   i <=pgsize
show   " <tr   onmouseover= " "this.bgColor= '#FEF9F4 '; " "   onmouseout= " "this.bgColor= ' '; " "> "
show   " <td   align= 'center '   width= " "25 " "   height= " "25 " "> <img   src= " "images/home_drop02.gif " "   width= " "4 " "   height= " "4 " "> </td> "
show   " <td   align= 'left '   height= " "25 " "> "
show   " <a   href= " "shownews.asp?id= "   &   rst( "NewsID ")   &   " " "   target= " "_blank " "> "
'show   " <img   src= " "images\arrow03.gif " "   border= " "0 " "   align= " "absmiddle " "> &nbsp; "  
show     rst( "Title ")   &   " </a> "
show   " <td   width= " "70 " "> <font   color= " "#D6CFD5 " "> "   &   formatdatetime(rst( "UploadTime "),vbshortdate)   &   " </font> </td> </tr> "
i=i+1
rst.movenext
loop

'显示新闻列表结束
show   " </table> <br> <br> "

'显示新闻面页链接
show   " <table   width= " "98% " "   height= " "30 " "     border= " "0 " "   cellspacing= " "0 " "   cellpadding= " "0 " "   style= " "border-top:   1px   dashed &n