大哥哥救救我啊。.

lucky749 2007-03-07 03:28:05
请问ASP怎样实现分页 
功能如下:

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

数据库为sql

...全文
159 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
hulin862008 2007-03-07
  • 打赏
  • 举报
回复
Server.MapPath("../db/xn31.mdb")是你本地数据库的路径
hulin862008 2007-03-07
  • 打赏
  • 举报
回复
<%
set conn=server.CreateObject("adodb.connection")
'conn.open "Driver={Micrsoft Access Driver (*.mdb)};dbq="&server.MapPath("xn31")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../db/xn31.mdb")
%>
lucky749 2007-03-07
  • 打赏
  • 举报
回复
你那里有数据库连接的吗?小弟我才刚学啊
hulin862008 2007-03-07
  • 打赏
  • 举报
回复
完全能达到你要的那种哈!!代码有不要的你自己删除些哈
hulin862008 2007-03-07
  • 打赏
  • 举报
回复
<%
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&id=<%= rs(0) %>" onClick="return confirm('确认要删除?\r\n确认删除点击确定\n取消操作点击取消')")>删除</a>/<a href="hotel.asp?ac=mod1&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>            当前共<span class="STYLE1"><%= rs.recordcount %></span>条酒店信息    当前第<span class="STYLE1"><%= p %></span>页/共<span class="STYLE1"><%= rs.pagecount %></span>页        <a href="hotel.asp?page=1">首页</a>  <a href="hotel.asp?page=<%= p-1 %>">上一页</a>   <a href="hotel.asp?page=<%= p+1 %>">下一页</a>   <a href="hotel.asp?page=<%= rs.pagecount %>">尾页</a></td>
</tr>
</table>

<%
rs.close
set rs=nothing
%>

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧