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

请问我到底错在哪里了?很急,在线等。
这个分页代码,我错在哪里了。
我自己抄随书光盘上的,就是运行不正确,没有提示。但随书光盘上的代码,就能运行正确。我错在哪里了。


随书光盘上的代码:

<%@LANGUAGE= "VBSCRIPT "   CODEPAGE= "936 "%>
<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN "   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html   xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 "   />
<title> 分页技术 </title>
<style   type= "text/css ">
<!--
.STYLE1   {
font-size:   16px;
font-weight:   bold;
}
-->
</style>
</head>

<body>
<p   align= "center "   class= "STYLE1 "> 用户列表 </p>
<hr   />
<p> &nbsp; </p>
<table   width= "100% "   height= "30% "   border= "1 "   align= "center ">
    <tr>
        <td> 用户名 </td>
        <td> 用户姓名 </td>
        <td> 电子邮箱 </td>
    </tr>
<%
database   =   "user.mdb "
StrConnect   =   "Driver={Microsoft   Access   Driver   (*.mdb)};DBQ= "&Server.MapPath(database)
Set   conn   =   Server.CreateObject   ( "ADODB.Connection ")
conn.Open   StrConnect

Set   rs   =   Server.CreateObject( "ADODB.RecordSet ")
rs.Open   "Select   *   from   Users ",conn,1,1  

dim   page,allpages,counts
if   rs.eof   and   rs.bof   then
response.Write   "目前没有记录 "
else
counts=2
rs.pagesize=counts
allpages=rs.pageCount
page=request( "page ")

if   not   isNumeric(page)   then   page=1
if   isEmpty(page)   or   Cint(page)   <   1   then
page   =   1
elseif   Cint(page)   > =   allpages   then
page   =   allpages
end   if
rs.AbsolutePage   =   page
do   while(Not   rs.eof)   and   counts> 0
%>  

    <tr>
        <td   bordercolor= "1 "> <%=rs( "UserName ")%> </td>
        <td   bordercolor= "1 "> <%=rs( "Ename ")%> </td>
        <td   bordercolor= "1 "> <%=rs( "Email ")%> </td>
    </tr>
   
<%
counts   =   counts   -   1
rs.movenext
if   rs.eof   then   exit   do
loop
end   if
%>
    <tr   height= "50 ">
<td   height= "50 ">
<%
response.Write "当前共有 "&rs.recordCount& "条用户记录   "
%> </td>
<td>
<%
if   page   =   1   then  
response.Write   "首页|前页 &n