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 ...
随机推荐
- c++ 多线程(2000个)端口扫描(附源码)
目录 程序适应环境与基本介绍 程序适应环境与基本介绍 情况:开2000个线程,扫描主机上开启的端口,扫描时间40秒左右. 瓶颈:不管开5000还是更多,都不能大幅加快扫描时间. 瓶颈解决方法:可以使用 ...
- tensorflow学习笔记七----------卷积神经网络
卷积神经网络比神经网络稍微复杂一些,因为其多了一个卷积层(convolutional layer)和池化层(pooling layer). 使用mnist数据集,n个数据,每个数据的像素为28*28* ...
- oracle在没
db_user表中数据: name age nub 张三 13 13 张三 12 12 张三 12 13 张三 12 13 李四 12 12 李四 12 12 查询重复数据(一条) sql:selec ...
- 修改默认select样式
<style type="text/css"> .select_demo,.select_list { width: 400px; height: 60px; } .s ...
- IntelliJIdea初次接触
1.下载 在官网下载专业版https://www.jetbrains.com/idea/ 2.修改配置 bin目录下文件如下: 修改idea64.exe.vmoptions(64位执行文件idea64 ...
- windows_vs编译过程
visual studio 2010 编译程序时,首先是cpp经过预处理,处理掉#define,#include等等.#include部分,将头文件部分替换到cpp中.之后进行优化过程,到.s.之后进 ...
- 显示本机 Linux 系统上所有开放的端口列表
#!bin/bash#作者:liusingbon#功能:从端口列表中观测端口,关闭无用端口对应的服务,降低被意外攻击的可能性ss -nutlp |awk '{print $1,$5}' |awk -F ...
- 牛客假日团队赛5 F 随机数 BZOJ 1662: [Usaco2006 Nov]Round Numbers 圆环数 (dfs记忆化搜索的数位DP)
链接:https://ac.nowcoder.com/acm/contest/984/F 来源:牛客网 随机数 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言6 ...
- Codeforces 920 反图联通块 线段树质因数暴力
A #include <bits/stdc++.h> #define PI acos(-1.0) #define mem(a,b) memset((a),b,sizeof(a)) #def ...
- EasySwoole的入门学习
EasySwoole的入门学习 官网地址:https://www.easyswoole.com/ 一.安装easyswoole: (1)建立安装目录: cd /data mkdir easyswool ...