| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 349 人关注过本帖, 1 人收藏
标题:[原创]asp查询分页显示
只看楼主 加入收藏
毅逊
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2006-8-16
收藏(1)
 问题点数:0 回复次数:0 
[原创]asp查询分页显示

ss.asp如下:

<!--#include file="function.asp"-->
<form id="form1" name="form1" method="post" action="ss.asp">
请输入查询关键字:
<input type="text" name="a1" />
<input type="submit" name="Submit" value="提交" />
</form>
<table width="200" border="1">
<%
Dim db,ConnStr1
ConnStr1="Dbq="&Server.Mappath("admin.mdb")&";Driver={Microsoft Access Driver (*.mdb)}"
Set db=Server.CreateObject("ADODB.Connection")
db.Open ConnStr1
a1=request("a1")
set rsa1=server.CreateObject("adodb.recordset")
ccce1="select * from wz where title like '%"&trim(a1)&"%'"
rsa1.open ccce1,db,1
if not rsa1.bof and not rsa1.eof then
dim page_size
dim page_no
dim page_total
page_size=5
if request("page_no")="" then
page_no=1
else
page_no=cint(request("page_no"))
end if
session("page_no")=page_no
rsa1.pagesize=page_size
page_total=rsa1.pageCount
rsa1.absolutepage=page_no
dim I,J
i=0
j=page_size
do while not rsa1.eof and j>0
I=I+1
J=J-1
%>
<tr>
<td><%=rsa1("title")%></td>
</tr>
<%
rsa1.movenext
loop
end if
%>
</table>
<% call select_page(page_no,page_total,a1) %>

function.asp如下

<%
private sub select_page(page_no,total_page,a1)
Dim I
i=1
response.write "文章数量:"&eee&"&nbsp&nbsp"
if page_no=1 then
response.write "首页&nbsp"
else
response.write "<a href='ss.asp?page_no=" & I & "&a1="&a1&"'>首页</a>&nbsp"
end if
If page_no<>1 then
response.write "<a href='ss.asp?page_no="& (Page_no-1) &"&a1="&a1&"'>上一页</a>&nbsp"
else
response.write "上一页&nbsp"
end if
If Page_no <> total_page Then
response.write "<a href='ss.asp?page_no="& (Page_no+1) &"&a1="&a1&"'>下一页</a>&nbsp"
else
response.write "下一页&nbsp"
end if
if page_no=total_page then
response.write "尾页&nbsp"
else
response.write "<a href='ss.asp?page_no=" & total_page & "&a1="&a1&"'>尾页</a>"
end if
response.write "&nbsp页次:"&page_no&"/"&page_total&"&nbsp每页"&r&"&nbsp"
End sub
%>

2006-08-18 16:51
快速回复:[原创]asp查询分页显示
数据加载中...
 
   



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

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