| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 447 人关注过本帖
标题:为什么总显示错误?
只看楼主 加入收藏
niubiya001
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2007-10-26
收藏
 问题点数:0 回复次数:4 
为什么总显示错误?

<%
set rs=server.CreateObject("ADODB.recordset")
sql="select * from message order by id desc"
rs.pagesize=4
rs.open sql,conn,2,1
if not rs.eof or not rs.eof then
%>
<body bgcolor="#CCFFFF" leftmargin="40" rightmargin="40" topmargin="10">
<table align="center" border="1">
<tr height="20"><th colspan="7">留言内容</th></tr>
<%
totalput=rs.recordcount
perpagesize=rs.pagesize
currpage=request.QueryString("currpage")
if currpage="" then
currpage=1
elseif currpage<1 then
currpage=1
else currpage=clng(currpage)
end if

if currpage>rs.pagecount then
currpage=rs.pagecount
end if
if not isnumeric(currpage) then
currpage=1
end if
if (totalput mod perpagesize)=0 then
n=totalput\perpagesize
else n=totalput\perpagesize+1
end if
if n=0 then
n=1
end if
rs.move(currpage-1)*perpagesize
i=0
do while not rs.eof and i<perpagesize
%>
<tr height="20" bgcolor="#9999FF"><td width="10%">留言人</td><td width="10%"><%=rs("username")%></td>
<td width="10%">留言时间</td><td width="10%"><%=rs("messagetime")%></td><td width="10%">邮箱<%=rs("email")%></td><td width="10%">qq</td><td width="10%"><%=rs("qq")%></td></tr>

<tr height="20"><td width="10%">标题</td><td colspan="6"><%=rs("title")%></td></tr>

<tr height="20"><td colspan="7">留言内容</td></tr>

<tr height="45"><td colspan="7"><%=rs("message")%></td></tr>

<%
i=i+1
rs.movenext
loop
end if
%>
<tr height="10"><td colspan="7">
<%
k=currpage
if k<>1 then %>
<a href="displaymessage.asp?currpage=1">首页</a>
<a href="displaymessage.asp?currpage=<%=k-1%>">上一页</a>
<%else %>
首页 上一页
<% end if %>
<%
if k<>n then

%>
<a href="displaymessage.asp?currpage=<%=n+1%>">下一页</a>
<a href="diaplaymessage.asp?currpage=<%=n%>">尾页</a>
<% else
%>
下一页&nbsp;&nbsp;尾页
<%end if%>

搜索更多相关主题的帖子: sql message border center 
2007-11-18 23:57
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 
if not rs.eof or not rs.eof then
这句有问题,改成
if not rs.eof or not rs.bof then
还有,楼主,具体报什么错,哪里报错,标红显示并贴出出错信息,这样大家才好帮你分析。
2007-11-19 01:29
hmhz
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:30
帖 子:1890
专家分:503
注 册:2006-12-17
收藏
得分:0 
if not rs.eof or not rs.eof then
改成
if not(rs.eof and rs.bof) then

[编程论坛] ASP超级群:49158383  敲门暗号:ASP编程
龍艺博客 http://www.
2007-11-19 08:10
kira007
Rank: 2
等 级:论坛游民
帖 子:294
专家分:27
注 册:2007-6-28
收藏
得分:0 
if not rs.eof or not rs.eof then
这句 直接改为

do while not rs.eof

下面的 END IF 去掉
<%
i=i+1
rs.movenext
loop
end if
%>

生活的理想,就是为了理想的生活。
2007-11-19 11:50
hmhz
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:30
帖 子:1890
专家分:503
注 册:2006-12-17
收藏
得分:0 
楼上的,下面已经有分页的 do while not rs.eof and i&lt;perpagesize 你上面再加do while not rs.eof 不出错才怪

[编程论坛] ASP超级群:49158383  敲门暗号:ASP编程
龍艺博客 http://www.
2007-11-19 14:52
快速回复:为什么总显示错误?
数据加载中...
 
   



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

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