asp+mysql分页

2016-02-19 19:19 24 1 收藏

下面这个asp+mysql分页教程由图老师小编精心推荐选出,过程简单易学超容易上手,喜欢就要赶紧get起来哦!

【 tulaoshi.com - 编程语言 】

%
'asp+mysql分页,由axislover原创于2007年12月11日,是个雪花飘飘的日子
Dim strSql,Rs
Dim intRecordNum,intCurrentPage,intRowcount
intRowcount = 0
Dim intPageCount:intPageCount = 15  '每页20条记录
GetConn_Open
'获得总记录
Set Rs = Conn.Execute("SELECT COUNT(*) As intcounts FROM datainfo where sort=1 and flag_lm=1")
If Rs.Eof And Rs.Bof Then
 intRecordNum = 0
Else
 intRecordNum = Cint(Rs("intcounts"))
End If
Dim intTotalPages

If (intRecordNum mod intPageCount)0 Then
 intTotalPages = Int(intRecordNum/intPageCount) + 1
Else
 intTotalPages = intRecordNum/intPageCount
End If

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/bianchengyuyan/)


intCurrentPage = 1
If IsEmpty(Request("txtPage")) Or IsNull(Request("txtPage")) Or Trim(Request("txtPage"))="" Or (Not IsNumeric(Request("txtPage"))) Or Len(Request("txtPage"))8 Then
 intCurrentPage = 1
ElseIf Clng(Request("txtPage")) 1 Then
 intCurrentPage = 1
ElseIf Clng(Request("txtPage")) intTotalPages Then
 intCurrentPage = intTotalPages
Else
 intCurrentPage = Clng(Request("txtPage"))
End If
Set Rs = Nothing
Set Rs = Server.CreateObject("ADODB.RecordSet")
strSql = "SELECT id,name,recreation,characteristic,address FROM datainfo where sort=1 and flag_lm=1 Order By id DESC LIMIT " & (intCurrentPage - 1) * intPageCount & "," & intPageCount
Rs.Open strSql,Conn,1,1
If Rs.Eof And Rs.Bof Then
Else
 Do While Not Rs.Eof And intRowcount intPageCount
        intRowcount = intRowcount+1

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/bianchengyuyan/)

 Rs.MoveNext
 Loop
End If

 ShowPageNum intRecordNum,intTotalPages,intCurrentPage,intPageCount,objPage.txtScriptName,"?"

Rs.Close
Set Rs = Nothing
Set objPage = Nothing

改一改就可以用了,呵呵

来源:https://www.tulaoshi.com/n/20160219/1620731.html

延伸阅读
标签: Web开发
特性: 、支持datagrid,datalist等分种数据显示控件,理论上只要有datasource的控件都可以 、支持url方式分页,url分页的每一页都可以被搜索引擎搜到,并且支持url重写 、控件样式可自定义 、封装完全,使用过程序只需写一行代码 代码如下: /****************************************************************** ** 文件名:Pager.cs ...
。?php /** * a class use to connect the MySQL database and do some query * wayne ,Mar 11, 2002 */ class dbClass { var $hostName = "localhost"; var $dbName = "exhibit"; var $Login = "wayne"; var $Password = "xiao"; var $conn; var $result; function dbClass(){ $this-conn = mysql_connect("$hostName","$this-Login","$thi...
?php include("inc/PageQuery.inc"); $pq = new PageQuery(2); // 获取Connection $pq-myQuery("select * from users"); // 执行查询 while($row = mysql_fetch_array($pq-result) ) { echo $row["id"] . ", "; echo $row["Username"] . ", "; echo $row["Password"]; echo "br"; } echo $pq-PageLegend(); // 翻页栏 ?
标签: Web开发
代码如下:     rs.open sql,conn,1,1     if rs.eof and rs.bof then      response.write "p align='center'还没找到文章/p"   else    totalPut=rs.recordcount    maxperpage=18 &nb...
标签: ASP
  <% ' 分页程序 ' total_records 总记录数 ' everypage_records 每页显示条数 ' current_page 当前页数 ' url 要传递的url,这里可以含有要传递的变量,比如 "list.asp?" 或者"list.asp?keyword=key&" ' 程序调用比较简单,不过还是比PHP的麻烦,继续努力中 sub show_page(total_records,everypage_records,current_page,url) ...

经验教程

108

收藏

40
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部