ASP相关的,小弟基础差,请各大哥看一下哈,分页问题,不知问题出在那里,每次要显示第二页时就提示错误:[Microsoft][ODBC SQL Server Driver][SQL Server]关键字 'order' 附近有语法错误,有时还 下一页 看不到但有链接
以下是代码
<!--#include file="adminzx.asp"-->
<!--#include file="conn.asp"-->
<!--#include file="safe.asp"-->
<!--#include file="adoconn.asp"-->
<style type="text/css">
<!--
a:link {
color: #000000;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #FFFFFF;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
.STYLE1 {font-size: small}
.STYLE2 {color: #000000}
body,td,th {
color: #000000;
}
-->
</style>
<%
dim  names
names= request.QueryString("MLname")
Set rs22= Server.CreateObject("ADODB.Recordset")
Page=clng(request("page")) '接收page变量
page_n="xxoo2.asp"    '当前需分页的页面
num=100                      '每页显示100条
sql="select  * from  "&names&" order by 工号 "   '要进行分页的数据表 rs22.open sql,conn,3,3
if rs22.eof or rs22.bof then
response.Write("<div align='center'>暂时没有信息!</div>")
response.end()
else
rs22.PageSize=num        '1 第页显示的条数
Pages=rs22.Pagecount     '2 得到最大分页数

if Page<=0 then Page=1  '如果值为0,就是第一页
if Page > Pages then Page=Pages '控制最后一页,不得大于最大分页数

rs22.AbsolutePage=Page    '用来确认每页的开始指针位置  

for i=1 to rs22.PageSize
%>
<table width="1143" border="0" cellpadding="0" cellspacing="0">
  <tr>
   <td width="188"><div align="center"><span class="STYLE1"></span>192.168.1.1</div></td>
   <td width="147"><div align="center" class="STYLE1"><%=rs22("工号")%></div></td>
   <td width="150"><div align="center" class="STYLE1"><%=rs22("任务名称")%></div></td>
   <td width="148"><div align="center" class="STYLE1"><%=rs22("会员票数")%></div></td>
   <td width="147"><div align="center" class="STYLE1"><%=rs22("最后更新")%></div></td>
   <td width="153"><div align="center" class="STYLE1"><a href='javascript:con=window.confirm("您确定要删除当前会员票数吗?");if (con)  location="xxoosc.asp?MLname=<%=rs22("编号")%>&mc=<%=rs22("任务名称")%>";else location="tplb.asp";' >删除</a></div></td>
   <td width="201"><div align="center" class="STYLE1"><a href="xxooxg.asp?MLname=<%=rs22("编号")%>&mc=<%=rs22("任务名称")%>&ps=<%=rs22("会员票数")%>&gh=<%=rs22("工号")%>">修改</a></div></td>
    </tr>
  </table>
<%
rs22.movenext
if rs22.eof then exit for
next
end ifif Page<2 then      
    response.write "首页 上一页&nbsp;"
  else
    response.write "<a href="&page_n&"?page=1>首页</a>&nbsp;"
    response.write "<a href="&page_n&"?page="&Page-1&">上一页</a>&nbsp;"
  end if
  
if Pages-Page<1 then
    response.write "下一页 尾页"
else
    response.write "<a href="&page_n&"?page="&page+1& ">"
    response.write "下一页</a> <a href="&page_n&"?page="&rs22.pagecount&">尾页</a>"
  end if
   response.write "&nbsp;页次:<strong><font color=red>"&Page&"</font>/"&rs22.pagecount&"</strong>页 "
    response.write "&nbsp;共<b><font color='#FF0000'>"&rs22.recordcount&"</font></b>条记录 <b>"&rs22.pagesize&"</b>条记录/页"
   response.write " </span></p>"     

rs22.close
set rs22=nothing
%>