| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 463 人关注过本帖
标题:getrows方法做的分页程序,出了一些问题
只看楼主 加入收藏
skyisblue
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-4-23
收藏
 问题点数:0 回复次数:0 
getrows方法做的分页程序,出了一些问题

<!--#include file="include/conn.asp"-->
<!--#include file="include/functions.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" type="text/css" />
</head>
<body>
<div id="warpper">
<!--head start-->
<div id="head-div">
<div id="head-logo"></div><div id="head-right"></div>
<div id="head-body">
<a href="#">安全登出</a> <img src="css/images/line2.jpg" width="2" height="41" align="absmiddle">
<a href="#">返回首页</a>
</div>
</div>
<!--head end-->
<%
dim Intsortid,Strtypename
dim Currentpage,Startposition,Arynews,Intlist
dim Rsnews,Sqlnews
Intsortid=1 'sql注入函数
Currentpage=cint(flitersql(request.QueryString("pageNo"),0)) '已经赋值的,isempty判断,初步处理
if Currentpage="" or Currentpage<0 then currentpage=0
Startposition=4*Currentpage '从记录集中截取记录的开始位置
set Rsnews=objconn.execute("select sortid,sortname from newssort where sortid="&Intsortid)
if Rsnews.eof then response.write("不存在此新闻类别") : response.End() else Strtypename=Rsnews("sortname"):

Rsnews.close:set Rsnews= nothing
%>
<!--navigation start-->
<div id="navigation">
<h1>您的位置:<a href=#>首页</a>&gt;&gt;<a href="newsclass.asp?type=<%=Intsortid%>"><%=Strtypename%></a></h1>
</div>
<!--navigation end-->
<!--main-div start-->
<div id="main-div">
<div id="rightlist">
<h2>新闻列表</h2>
<table border="0" cellspacing="5" cellpadding="0" class="indexnews-list">
<%
Sqlnews="select newsid,title,ispic,edittime,hits from news where sortid="&Intsortid&" order by edittime desc"
set Rsnews=server.CreateObject("ADODB.Recordset")
Rsnews.open Sqlnews,objconn,1,1
if Rsnews.eof then response.Write("<tr><td>该条目中暂时没有上传新闻</td></tr>") : redim Arynews(4,-1) else Arynews=Rsnews.getrows(4,Startposition) : Rsnews.close:set Rsnews=nothing
if ubound(Arynews,2)>=0 then
for Intlist=0 to ubound(Arynews,2)
%>
<tr><td>·<a href="newsview.asp?newsid=<%=Arynews(0,Intlist)%>"><%=Arynews(1,Intlist)%><%if not isnull(Arynews(2,Intlist)) then response.Write("<span class='redtu'>(图)</span>")%></a><span class="detail">[<%=Arynews(3,Intlist)&"浏览:"&Arynews(4,Intlist)&"次"%>]</span></td></tr>
<%next
end if%>
<tr><td style="text-align:right; border-top:1px solid #eee; padding-top:5px;">
<img src="css/images/up.gif" width="16" height="16" align="absmiddle" /><a href="newsclass.asp?pageNo=<%=(currentpage-1)%>&newstype=<%=Intsortid%>">上一条</a>
<img src="css/images/down.gif" width="16" height="16" align="absmiddle" /><a href="newsclass.asp?pageNo=<%=(currentpage+1)%>&newstype=<%=Intsortid%>">下一条</a></td>
</tr>
</table>
</div>

</div>

<!--main-div end--></div><!--warpper end -->
</body>
</html>

不想利用abosoultpage方法进行分页,在这里利用了getrows方法,但不知怎么出了问题,
在利用Startposition截取记录集信息的时候,只能截取到从0条开始的记录,如果Startposition赋值为4时就不能从记录集的第四条记录截取,是不是记录集的游标设置问题?急。

搜索更多相关主题的帖子: blank content include PUBLIC target 
2006-04-23 11:11
快速回复:getrows方法做的分页程序,出了一些问题
数据加载中...
 
   



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

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