ASP 数据库分页
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
Response.buffer=false
%>
<!--#include file="./inc/conn.asp"-->
<!--#include file="./inc/const.asp"-->
<!--#include file="./inc/char.asp"--> <!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>
<link href=./css/main.css rel=stylesheet>
<script language=JavaScript>
<!--
function DoEmpty(params)
{
if (confirm("真的要删除这条记录吗?删除后此记录里的所有内容都将被删除并且无法恢复!"))
window.location = params ;
}
//-->
</script>
</head>
<body> <br />
<table width="98%" cellspacing="1" cellpadding="3" bgcolor="#999999" align="center">
<tr bgcolor="#CCCCCC" align=center>
<td colspan="5"><b>信息</b></td>
</tr>
<%
dim pagecount,page,Spage,Epage,recordcount,i
page = request.querystring("page")
if page = "" or IsNull(page) then page = 1
if not IsNumeric(page) then page = 1
page = Cint(page)
set rs = server.CreateObject ("Adodb.recordset")
sql = "select * from goods order by id asc"
rs.open sql,conn,1,1
recordcount = RS.RecordCount
RS.PageSize = PAGESIZE
pagecount = RS.PageCount
if page < 1 then
page = 1
elseif page > pagecount then
page = pagecount
end if
if RS.EOF then%>
<tr bgcolor="#ffffff" height=20>
<td colspan="4" ><center><font color=#cc0000>目前还没有任何信息!</font><%if session("userkey")=4 then%> 请[<a href=add.asp?action=addmsg>点击这里</a>]发布信息<%end if%></td>
</tr></table>
<%else%>
<tr bgcolor="#ffffff" height=25><td colspan="4" ></tr>
<%if recordcount > 0 then RS.AbsolutePage = page
for i = 1 to PAGESIZE
if RS.EOF then exit for%>
<tr bgcolor="#dddddd"><td width=3%><center><img src=./img/folder.gif></td><td><b><%=rs("goods_id")%></b> (<%=rs("goods_name")%>)</td><td width=10%><center><font color=blue><%=rs("goods_price")%></font></td><td width=10%> |</td></tr> <%
RS.MoveNext()
next
end if
%>
</table> <%
if pagecount > 0 then
response.write("<table width=""95%"" align=center cellspacing=3 cellpadding=3><tr><td align=right>")
response.write("页次:<font color=red><b>" & page & "</font>/" & pagecount & "</b> 每页<b>" & pagesize & "</b> 共<b>" & recordcount & "</b>条留言 分页:")
Spage = page mod PARTSIZE
if page > PARTSIZE then
if Spage = 0 then Spage = PARTSIZE
Spage = page - Spage + 1
else
Spage = 1
end if
Epage = Spage + PARTSIZE - 1
if Epage > pagecount then Epage = pagecount
if page > PARTSIZE then
response.write("<a href=""?page=" & Spage - 1 & """>[<<]</a>")
end if
for i = Spage to Epage
if i = page then
response.write("[<font color=red><b>" & i & "</b></font>]")
else
response.write("[<a href=""?page=" & i & """>" & i & "</a>]")
end if
next
if Epage < pagecount then
response.write("<a href=""?page=" & Epage + 1 & """>[>>]</a>")
end if
if Spage <> 1 then response.write("[<a href=""?page=1"">首页</a>]")
if Epage <> pagecount then response.write("[<a href=""?&page=" & pagecount & """>尾页</a>]")
response.write("</td></tr></table><br>")
end if
rs.close
set rs=nothing%> <script type="text/javascript">
function openwindow(url,name,iWidth,iHeight)
{
var url; //转向网页的地址;
var name; //网页名称,可为空;
var iWidth; //弹出窗口的宽度;
var iHeight; //弹出窗口的高度;
//window.screen.height获得屏幕的高,window.screen.width获得屏幕的宽
var iTop = (window.screen.height-30-iHeight)/2; //获得窗口的垂直位置;
var iLeft = (window.screen.width-10-iWidth)/2; //获得窗口的水平位置;
// window.open(url,name,'height='+iHeight+',,innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');
openWin(url,name,'height='+iHeight+',,innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');
} /**
* 监听打开的弹窗,关闭后刷新页面
*/
function openWin(url,text,winInfo){
var winObj = window.open(url,text,winInfo);
var loop = setInterval(function() {
if(winObj.closed) {
clearInterval(loop);
//alert('closed');
parent.location.reload();
}
}, 1);
} </script> <hr align="center" width="90%" size="1">
<p align="center" class="style1">
Powered by wgscd</p>
</body>
</html>
const.asp: %>
<%
Const PAGESIZE=20
Const PARTSIZE=10
Const AboutSize=8
%> conn.asp: <%
dim conn
dim connstr
dim db
db="./data/goods.mdb"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.Open connstr %>
ASP 数据库分页的更多相关文章
- asp.net分页控件
一.说明 AspNetPager.dll这个分页控件主要用于asp.net webform网站,现将整理代码如下 二.代码 1.首先在测试页面Default.aspx页面添加引用 <%@ Reg ...
- asp.net 分页-自己写分页控件
去年就发表过asp.net 分页-利用后台直接生成html分页 ,那种方法只是单纯的实现了分页,基本不能使用,那时就想写个自己的分页控件,无奈能力有限.最近有点时间了,就自己做出了这个分页控件.我承认 ...
- 浅谈SQL Server数据库分页
数据库分页是老生常谈的问题了.如果使用ORM框架,再使用LINQ的话,一个Skip和Take就可以搞定.但是有时由于限制,需要使用存储过程来实现.在SQLServer中使用存储过程实现分页的已经有很多 ...
- 各种数据库分页sql
1.oracle数据库分页 select * from (select a.*,rownum rc from 表名 where rownum<=endrow) a where a.rc>= ...
- Oracle数据库和DB2数据库分页SQL的区别举例
--------------------------ORACLE数据库分页SQL举例------------------------------------------------ SELECT * ...
- MySQL、SqlServer、Oracle三大主流数据库分页查询
在这里主要讲解一下MySQL.SQLServer2000(及SQLServer2005)和ORCALE三种数据库实现分页查询的方法.可能会有人说这些网上都有,但我的主要目的是把这些知识通过我实际的应用 ...
- Sqlserver数据库分页查询
Sqlserver数据库分页查询一直是Sqlserver的短板,闲来无事,想出几种方法,假设有表ARTICLE,字段ID.YEAR...(其他省略),数据53210条(客户真实数据,量不大),分页查询 ...
- Statement和PreparedStatement的特点 MySQL数据库分页 存取大对象 批处理 获取数据库主键值
1 Statement和PreparedStatement的特点 a)对于创建和删除表或数据库,我们可以使用executeUpdate(),该方法返回0,表示未影向表中任何记录 b)对于创建和 ...
- (转)asp.net分页存储过程
Asp.Net分页存储过程 SQL分页语句 一.比较万能的分页: sql代码: 1 2 3 select top 每页显示的记录数 * from topic where id not in (sel ...
随机推荐
- CSP-J&S 2019游记
$Day -???$ 和爱国爱党的$LQX$书记打了个赌,谁$TG$分低请另一个京味斋. $Day 0$ 机房同学去聚餐,美其名曰"散伙饭",可能又有几个进队的... 我没有去,因 ...
- 使用before和after双伪元素清除浮动
使用方法: .clearfix:before,.clearfix:after { content:"."; display:table; } .clearfix:after { c ...
- 给定一个英文字符串,请编写一个PHP函数找出这个字符串中首先出现三次的那个英文字符(需要区分大小写),并返回
给定一个英文字符串,请编写一个PHP函数找出这个字符串中首先出现三次的那个英文字符(需要区分大小写),并返回 //统计字符串中出现的字符的出现次数 public function strNum(){ ...
- Node.js连接RabbitMQ,断线重连,动态绑定routing key
RabbitMQ官方提供的教程https://www.rabbitmq.com/tuto...,是基于回调的. 下面将给出基于Promise式的写法.并且实现动态的队列绑定 初始化配置 const a ...
- 剑指offer-回溯法-机器人的运动范围-python
题目描述 地上有一个m行和n列的方格.一个机器人从坐标0,0的格子开始移动,每一次只能向左,右,上,下四个方向移动一格,但是不能进入行坐标和列坐标的数位之和大于k的格子. 例如,当k为18时,机器人能 ...
- c# 数据库基础(将连接字符串写到配置文件中)
数据库 操作步骤 一,添加一个配置文件 内容 <?xml version="1.0" encoding="utf-8" ?> <configu ...
- 微信小程序 IView List与Icon结合使用
wxml <i-cell-group> <i-cell title="测试" is-link> <i-icon slot= ...
- python 模块发布及使用
将模块(此处名为nester)写好后,与setup.py放入同一个文件夹中: //setup.py from distutils.core import setup setup( name=" ...
- Spring基础08——使用p命名空间
1.使用p命名空间 为了简化xml配置,越来越多的xml文件采用属性而非子元素配置信息,Spring从2.5版本开始引入了一个新的p命名空间,可以通过<bean>元素属性的方式配置Bean ...
- Linux 开机自动启动脚本
1)编写要执行脚本的sh文件mysetup.sh #!/bin/sh ### BEGIN INIT INFO # Provides: land.sh # Required-start: $local_ ...