| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 568 人关注过本帖
标题:CS分页类V1.2
只看楼主 加入收藏
keechi
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-3-23
收藏
 问题点数:0 回复次数:1 
CS分页类V1.2
<%
'转发时请保留此声明信息,这段声明不并会影响你的速度!
'*******************   CS分页类V1.2  ************************************
'作者:ColorSunny
'日 期:2006-02-26
'网站:http://www.900wan.com
'电子邮件:keechi@163.com
'版权声明:版权所有,源代码公开,各种用途均可免费使用,但是修改后必须把修改后的文件
'发送一份给作者,并且保留作者此版权信息
'类属性说明:
'strSql  SQL语句  必选项
'PageSize 每页条数 可选 默认为10
'strUrl  联接地址 可选  默认为 "?page=" 可写为如 "Article_List.asp?Class=222&page="
'strUnit 统计信息 可选 默认为 "共$A$条记录,$B$条记录/页,当前第$C$页" 其中$A$ $B$ $C$ 将被替换成数字  
'strFst  首页  可选 默认为 "首页"
'strPre  上一页  可选 默认为 "上一页"
'strNxt  下一页  可选 默认为 "下一页"
'strLst  尾页  可选 默认为 "尾页"
'strGoto 转到  可选 默认为 "转到"
'connection 数据库链接 可选 默认为 conn
'**********************************************************************
'应用实例
'set dp1 = new CS_DividePage
'dp1.strSql = "select * from Article"
'Set rs = dp1.Recordset
'For i = 1 To dp1.Pagesize
' If rs.Eof Then Exit For
' Response.Write rs("artTitle") & "<BR>"
' rs.Movenext
'Next
'dp1.ShowPage()
'set dp1 = nothing
'**********************************************************************
Class CS_DividePage
Dim Page, PageCount, RsCount, z
Dim PageSize_CS, strUrl_CS, strUnit_CS, strSql_CS, conn_CS '需要得到的参数
Dim strFst_CS, strPre_CS, strNxt_CS, strLst_CS, strGoto_CS '需要得到的参数

Public Property Let strSql(ParamA) 'Sql字符串
  strSql_CS=ParamA
End Property
Public Property Let PageSize(ParamB) '每页大小
  PageSize_CS=ParamB
End Property
Public Property Let strUrl(ParamC) '地址
  strUrl_CS=ParamC
End Property
Public Property Let strUnit(ParamD) '单位
  strUnit_CS=ParamD
End Property
Public Property Let strFst(ParamE) '首页
  strFst_CS=ParamE
End Property
Public Property Let strPre(ParamF) '上一页
  strPre_CS=ParamF
End Property
Public Property Let strNxt(ParamG) '下一页
  strNxt_CS=ParamG
End Property
Public Property Let strLst(ParamH) '尾页
  strLst_CS=ParamH
End Property
Public Property Let strGoto(ParamI) '转向
  strGoto_CS=ParamI
End Property
Public Property Let connection(ParamJ) '数据库链接
  Set conn_CS=ParamJ
End Property
Private Sub Class_Initialize '类初始化
  Page = Request("page")
  If Page = "" Then Page = 1 Else If Not IsNumeric(Page) Then Page = 1
  Page = CInt(Page)
  If Page < 1 Then Page = 1
  PageSize_CS = 10
  strUrl_CS = "?page="
  strUnit_CS = "共$A$条记录,$B$条记录/页,当前第$C$页"
  strFst_CS = "首页"
  strPre_CS = "上一页"
  strNxt_CS = "下一页"
  strLst_CS = "尾页"
  strGoto_CS = "转到"
  If IsObject(conn) Then Set conn_CS = conn
End Sub
Private Sub Class_Terminate  '类终止
  Recordset.Close
  'Set Recordset = Nothing
End Sub
Public Property Get PageSize
  PageSize = PageSize_CS
End Property
Public Property Get Recordset '打开记录并分页
  Set Recordset = Server.CreateObject("Adodb.RecordSet")
  Recordset.open strSql_CS, conn_CS, 1, 1
  Recordset.PageSize = PageSize_CS
  PageCount = Recordset.PageCount
  RsCount = Recordset.RecordCount
  If Page > PageCount Then Page = PageCount
  If Not Recordset.Eof Then Recordset.AbsolutePage = Page
End Property

Public Sub ShowPage()
  If Page > 1 Then
   Response.Write "<a href=""" & strUrl_CS & "1"">" & strFst_CS & "</a>&nbsp;&nbsp;"
   Response.Write "<a href=""" & strUrl_CS & Page-1 & """>" & strPre_CS & "</a> "
  Else
   Response.Write strFst_CS & "&nbsp;&nbsp;" & strPre_CS
  End If
  
  Response.Write " (" & Replace(Replace(Replace(strUnit_CS, "$A$", RsCount), "$B$", PageSize_CS),"$C$" , Page & "/" & PageCount) & ") "
  If PageCount > Page Then
   Response.Write "<a href=""" & strUrl_CS & Page+1 & """>" & strNxt_CS & "</a>&nbsp;&nbsp;"
   Response.Write "<a href=""" & strUrl_CS & PageCount & """>" & strLst_CS & "</a>"
  Else
   Response.Write strNxt_CS & "&nbsp;&nbsp;" & strLst_CS
  End If
  
  Response.Write VbCrlf & "&nbsp;&nbsp;" & strGoto_CS & "&nbsp;<select name=""GotoPage_ColorSunny"" onchange=""window.location.href='"
  Response.Write strUrl_CS & "'+GotoPage_ColorSunny.value"">"
  For z = 1 To PageCount
   Response.Write "<option value=" & z
   If z = Page Then Response.Write " selected "
   Response.Write ">" & z & "</option>" & VbCrlf
  Next
  Response.Write "</select>"
End Sub
End class
%>

[此贴子已经被作者于2006-3-23 16:10:41编辑过]



c4yw9Xew.rar (2.08 KB) CS分页类V1.2

搜索更多相关主题的帖子: 页类 电子邮件 源代码 target 
2006-03-23 16:10
冰镇柠檬汁儿
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:北京
等 级:版主
威 望:120
帖 子:8078
专家分:6657
注 册:2005-11-7
收藏
得分:0 
好东西,要顶

本来无一物,何处惹尘埃
It is empty at all here, Why pm 2.5 is so TMD high!
2006-03-23 16:39
快速回复:CS分页类V1.2
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.031693 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved