| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 853 人关注过本帖
标题:可以加个分页功能吗,谢谢
只看楼主 加入收藏
l373889105
Rank: 1
等 级:新手上路
帖 子:28
专家分:0
注 册:2007-5-16
收藏
 问题点数:0 回复次数:10 
可以加个分页功能吗,谢谢

<%text1=Request("text1") %>
<%text2=Request("text2") %>
<%text3=Request("text3") %>

<%
set conn=server.createobject("adodb.connection")
conn.open="driver={sql server};server=127.0.0.1;uid=sa;pwd=;database=tjphone"
set rs=conn.execute("tianjin")
%>


<%
if text1<>""or text2<>"" or text3<>"" then
sql="select * from tianjin where chanpin like " & "'%" &text1& "%'" & " and xingzhi like " & "'%" &text2& "%'" &"and lxdd like " & "'%" &text3& "%'"
set rs=conn.execute(sql)

while not rs.eof

row="<tr align=middle>"
for i=0 to rs.fields.count-1
row=row&"<td>"&rs(i)&"</td>"
next
Response.Write row&"</tr>"
rs.movenext
wend
rs.close

else
Response.Write("没有找到相关数据")
end if
%>
这是一个查询浏览,我希望可以分页,可以帮我加个分页功能吗,谢谢了.

搜索更多相关主题的帖子: set Request 
2007-06-23 09:05
aimama
Rank: 1
等 级:新手上路
帖 子:41
专家分:0
注 册:2007-6-19
收藏
得分:0 
<FORM name=ArticleList action=""
method=post>
共找到&nbsp;<B><%=rs.recordcount%></B>&nbsp;条记录&nbsp;&nbsp;每页显示&nbsp;<B><%=ps%></B>&nbsp;条&nbsp;&nbsp;<B><%=page%>/<%=rs.pagecount%></B>&nbsp;页&nbsp;&nbsp;<A class=text_all href="?page=1&sort=<%=request("sort")%>">第一页</A>&nbsp;<A class=text_all href="?page=<%=page-1%>&sort=<%=request("sort")%>">上页</A>&nbsp;<A class=text_all href="?page=<%=page+1%>&sort=<%=request("sort")%>">下页</A>&nbsp;<A class=text_all href="?page=<%=rs.pagecount%>&sort=<%=request("sort")%>">尾页</A>&nbsp;
<SELECT name=change_page>
<%for i=1 to rs.pagecount %>
<OPTION value=<%=i%>&sort=<%=request("sort")%>>第<%=i%>页</OPTION>
<%
next
%>
</SELECT>
<INPUT
type=hidden name=MaxID>
<INPUT type=hidden name=MinID>
<INPUT
type=hidden name=SearchKeyword>
<INPUT type=hidden
name=SearchSelect>
<INPUT type=hidden
value=# name=str>
<SCRIPT language=VBScript>
sub change_page_onchange()
str=ArticleList.str.value
strs=split(str,"#")
page=ArticleList.change_page.value
strh="?page="&page
for i_page = 0 to ubound(strs)-1 step 2
strh=strh & "&" & strs(i_page) & "=" & strs(i_page+1)
next
location.href=strh
end sub
</SCRIPT>
</FORM>
2007-06-23 10:09
l373889105
Rank: 1
等 级:新手上路
帖 子:28
专家分:0
注 册:2007-5-16
收藏
得分:0 
哥哥们,我看不懂啊.怎么办啊.
2007-06-23 10:24
aimama
Rank: 1
等 级:新手上路
帖 子:41
专家分:0
注 册:2007-6-19
收藏
得分:0 
多看几下

<FORM name=ArticleList action="" method=post>
共找到&nbsp;<B><%=rs.recordcount%></B>&nbsp;条记录&nbsp;&nbsp;每页显示&nbsp;<B><%=ps%></B>&nbsp;条&nbsp;&nbsp;<B><%=page%>/<%=rs.pagecount%></B>&nbsp;页&nbsp;&nbsp;<A
href="?page=1&sort=<%=request("sort")%>">第一页</A>&nbsp;
<A href="?page=<%=page-1%>&sort=<%=request("sort")%>">上页</A>&nbsp;

<A href="?page=<%=page+1%>&sort=<%=request("sort")%>">下页</A>&nbsp;

<A href="?page=<%=rs.pagecount%>&sort=<%=request("sort")%>">尾页</A>&nbsp;

<SELECT name=change_page>
<%for i=1 to rs.pagecount %>
<OPTION value=<%=i%>&sort=<%=request("sort")%>>第<%=i%>页</OPTION>
<%
next
%>
</SELECT>
<INPUT
type=hidden name=MaxID>
<INPUT type=hidden name=MinID>
<INPUT
type=hidden name=SearchKeyword>
<INPUT type=hidden
name=SearchSelect>
<INPUT type=hidden
value=# name=str>
<SCRIPT language=VBScript>
sub change_page_onchange()
str=ArticleList.str.value
strs=split(str,"#")
page=ArticleList.change_page.value
strh="?page="&page
for i_page = 0 to ubound(strs)-1 step 2
strh=strh & "&" & strs(i_page) & "=" & strs(i_page+1)
next
location.href=strh
end sub
</SCRIPT>
</FORM>
2007-06-23 10:36
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 
[url]http://bbs.bc-cn.net/viewthread.php?tid=149264[/url]
看看这个,对你有帮助
2007-06-23 10:45
gdk2006
Rank: 4
等 级:业余侠客
威 望:8
帖 子:928
专家分:270
注 册:2006-7-2
收藏
得分:0 
直接加一个翻页函数!然后CALL

程序员的悲哀如何找女朋友?
追女解决方案百度“让她着迷”!
2007-06-23 13:56
l373889105
Rank: 1
等 级:新手上路
帖 子:28
专家分:0
注 册:2007-5-16
收藏
得分:0 

<%text1=Request("text1") %>
<%text2=Request("text2") %>
<%text3=Request("text3") %>

<%
set conn=server.createobject("adodb.connection")
conn.open="driver={sql server};server=127.0.0.1;uid=sa;pwd=;database=tjphone"
set rs=conn.execute("tianjin")
%>


<%
if text1<>""or text2<>"" or text3<>"" then
sql="select * from tianjin where chanpin like " & "'%" &text1& "%'" & " and xingzhi like " & "'%" &text2& "%'" &"and lxdd like " & "'%" &text3& "%'"
set rs=conn.execute(sql)

while not rs.eof

row="<tr align=middle>"
for i=0 to rs.fields.count-1
row=row&"<td>"&rs(i)&"</td>"
next
Response.Write row&"</tr>"
rs.movenext
wend
rs.close

else
Response.Write("没有找到相关数据")
end if
%>
这是一个查询浏览,我希望可以分页,可以帮我加个分页功能吗,谢谢了.


高手,请帮帮我吧,我就要分页啊.

2007-06-23 14:55
zhulei1978
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:53
帖 子:1351
专家分:1200
注 册:2006-12-17
收藏
得分:0 

<%text1=Request("text1") %>
<%text2=Request("text2") %>
<%text3=Request("text3") %>

<%
set conn=server.createobject("adodb.connection")
conn.open="driver={sql server};server=127.0.0.1;uid=sa;pwd=;database=tjphone"
set rs=conn.execute("tianjin")
%>


<%
if text1<>""or text2<>"" or text3<>"" then
sql="select * from tianjin where chanpin like " & "'%" &text1& "%'" & " and xingzhi like " & "'%" &text2& "%'" &"and lxdd like " & "'%" &text3& "%'"
set rs=conn.execute(sql)
if not(rs.eof) then
rs.PageSize=4
if request("page")<>"" then
ipage=Cint(request("page"))
if ipage<1 then ipage=1
if ipage>rs.PageCount then ipage=rs.PageCount
else
ipage=1
end if
response.write("当前第"&ipage&"页,共"&rs.PageCount&"页")
rs.AbsolutePage=ipage

for i=0 to rs.PageSize-1
if rs.eof or rs.bof then exit for
row="<tr align=middle>"
for i=0 to rs.fields.count-1
row=row&"<td>"&rs(i)&"</td>"
next
Response.Write row&"</tr>"
rs.movenext
next
%>
<br>
<%
if ipage<>1 then %>
<a href="page.asp?page=1">第一页</a>
<a href="page.asp?page=<%ipage-1%>">上一页</a>
<% end if
if ipage<>rs.PageCount then %>
<a href="page.asp?page=<%=ipage+1%>">下一页</a>
<a href="page.asp?page=<%=rs.PageCount%>">最后页</a>
<% end if
rs.close
end if
else
Response.Write("没有找到相关数据")
end if
%>

将其中page.asp改为你的文件名

[此贴子已经被作者于2007-6-23 21:13:36编辑过]


其实我就是改变社会风气,提高少女素质,刺激电影市道,提高年轻人内涵,玉树临风,风度翩翩的整蛊专家,我名叫古晶,英文名叫JingKoo!
2007-06-23 21:09
l373889105
Rank: 1
等 级:新手上路
帖 子:28
专家分:0
注 册:2007-5-16
收藏
得分:0 
Microsoft VBScript 编译器错误 (0x800A0410)
循环控制变量 'for' 无效
/page.asp, line 32, column 5
for i=0 to rs.fields.count-1
----^
2007-06-23 22:20
zhulei1978
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:53
帖 子:1351
专家分:1200
注 册:2006-12-17
收藏
得分:0 

<%text1=Request("text1") %>
<%text2=Request("text2") %>
<%text3=Request("text3") %>

<%
set conn=server.createobject("adodb.connection")
conn.open="driver={sql server};server=127.0.0.1;uid=sa;pwd=;database=tjphone"
set rs=conn.execute("tianjin")
%>


<%
if text1<>""or text2<>"" or text3<>"" then
sql="select * from tianjin where chanpin like " & "'%" &text1& "%'" & " and xingzhi like " & "'%" &text2& "%'" &"and lxdd like " & "'%" &text3& "%'"
set rs=Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,3,1
if not rs.eof then
rs.PageSize=4
if request("page")<>"" then
ipage=Cint(request("page"))
if ipage<1 then ipage=1
if ipage>rs.PageCount then ipage=rs.PageCount
else
ipage=1
end if
response.write("当前第"&ipage&"页,共"&rs.PageCount&"页")
rs.AbsolutePage=ipage


for i=0 to rs.PageSize-1
if rs.eof or rs.bof then exit for
row="<tr align=middle>"
for j=0 to rs.fields.count-1
row=row&"<td>"&rs(j)&"</td>"
next
Response.Write row&"</tr>"
rs.movenext
next
%>
<br>
<%
if ipage<>1 then %>
<a href="page.asp?page=1">第一页</a>
<a href="page.asp?page=<%=ipage-1%>">上一页</a>
<% end if
if ipage<>rs.PageCount then %>
<a href="page.asp?page=<%=ipage+1%>">下一页</a>
<a href="page.asp?page=<%=rs.PageCount%>">最后页</a>
<% end if
rs.close
end if
else
Response.Write("没有找到相关数据")
end if
%>


其实我就是改变社会风气,提高少女素质,刺激电影市道,提高年轻人内涵,玉树临风,风度翩翩的整蛊专家,我名叫古晶,英文名叫JingKoo!
2007-06-24 13:58
快速回复:可以加个分页功能吗,谢谢
数据加载中...
 
   



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

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