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

大哥哥救救我啊。.
请问ASP怎样实现分页 
功能如下:

 上一页 下一页 首页 尾页 一工有?页 去第 ? 页

数据库为sql



------解决方案--------------------
<%
sql= "select * from hotel order by id desc "
set rs=server.createobject( "adodb.recordset ")
rs.open sql,conn,3,1
%>
<table width= "100% " border= "0 " align= "center " cellpadding= "6 " cellspacing= "1 " bgcolor= "#CCCCCC " class= "table_bg ">
<tr align= "center " bgcolor= "#E8E8E8 " class= "td_bg1 ">
<td width= "24 " height= "30 "> 编号 </td>
<td width= "62 " height= "30 "> 所属区域 </td>
<td width= "140 " height= "30 "> 酒店名称 </td>
<td width= "128 "> 酒店级别 </td>
<td width= "84 " height= "30 "> 挂牌价 </td>
<td width= "82 " height= "30 "> 散客价 </td>
<td width= "67 " height= "30 "> 团队价 </td>
<td width= "59 " height= "30 "> 操作 </td>
</tr>
<%
if rs.eof then
response.write " <tr> <td bgcolor=#FFFFFF colspan=7> <font color=#FF0000> 暂时没有数据! </font> </td> </tr> "
else
rs.pagesize=18
p=request.querystring( "page ")
if p= " " or p <1 then
p=1
end if
if cint(p)> cint(trim(rs.pagecount)) then
p=cint(trim(rs.pagecount))
end if
rs.absolutepage=p
for i=1 to rs.pagesize
%>
<tr bgcolor= "#FFFFFF ">
<td> <%= rs(0) %> </td>
<td> <%= rs( "h_type ") %> </td>
<td> <%= rs( "h_name ") %> </td>
<td align= "center "> <%= rs( "h_star ") %> </td>
<td> <%= rs( "h_public ") %> </td>
<td> <%= rs( "h_loose ") %> </td>
<td> <%= rs( "h_team ") %> </td>
<td align= "center "> <a href= "hotel.asp?ac=del&amp;id= <%= rs(0) %> " onClick= "return confirm( '确认要删除?\r\n确认删除点击确定\n取消操作点击取消 ') ")> 删除 </a> / <a href= "hotel.asp?ac=mod1&amp;id= <%= rs(0) %> "> 修改 </a> </td>
</tr>
<%
rs.movenext
if rs.eof then
exit for
end if
next
end if
%>
<tr bgcolor= "#FFFFFF ">
<td height= "35 " colspan= "8 " align= "center "> <a href= "hotel.asp?ac=add "> 添加酒店信息 </a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 当前共 <span class= "STYLE1 "> <%= rs.recordcount %> </span> 条酒店信息&nbsp;&nbsp;&nbsp;&nbsp;当前第 <span class= "STYLE1 "> <%= p %> </span> 页/共 <span class= "STYLE1 "> <%= rs.pagecount %> </span> 页&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href= "hotel.asp?page=1 "> 首页 </a> &nbsp;&nbsp; <a href= "hotel.asp?page= <%= p-1 %> "> 上一页 </a> &nbsp;&nbsp; <a href= "hotel.asp?page= <%= p+1 %> "> 下一页 </a> &nbsp