| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 726 人关注过本帖
标题:[求助]非常郁闷的问题
取消只看楼主 加入收藏
威龙嘉少
Rank: 1
等 级:新手上路
帖 子:205
专家分:0
注 册:2007-9-24
收藏
 问题点数:0 回复次数:2 
[求助]非常郁闷的问题

我做留言分页处理的时候,在分页显示的下面有多出了一条留言,而且这条留言是下一页的开始的那一天留言,当留言显示尾页 的时候,分页下面也就没有了留言了,有谁知道这是怎么回师啊,搞了几天了都没有看出来哪里错了,请高手指教啊,感激不尽,谢谢!
代码:
<%
set conn=server.createobject("adodb.connection")
DSNtemp = "Driver={Microsoft Access Driver (*.mdb)};"
DSNtemp = DSNtemp & "DBQ=" & server.mappath("xuesheng.mdb")
conn.open DSNtemp
set rs=Server.CreateObject("adodb.recordset")
sql ="select * from ly order by id desc"
rs.open sql,conn,1,1

if rs.eof and rs.bof then
response.Write("暂时还没有任何留言!")
else
totalput=rs.recordcount
response.Write(totalput)
listnum=10
rs.pagesize=listnum
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*listnum > totalput then
if (totalput mod listnum)=0 then
currentpage=totalput \ listnum
else
currentpage=totaaput \ listnum + 1
end if
end if
if currentpage=1 then
showContent
showpage totalput,listnum,"liuyan0.asp"
else
if (currentpage-1)* listnum < totalput then
rs.move (currentpage-1)*listnum
showContent
showpage totalput,listnum,"liuyan0.asp"
else
currentpage=1
showContent
showpage totalput,listnum,"liuyan0.asp"
end if
end if
rs.close
end if
set rs=nothing
conn.close
set conn=nothing
%>
<%
ly=replace(ly,chr(13)&chr(10),"<br>")
sub showcontent
do while not rs.eof
response.Write("<hr / color='blue' width='60%'>")
response.Write("<table border='1' bordercolor='red' width='60%'align='center'>")
response.Write("<tr>")
response.Write("<td>编号:</td>"&"<td>"&rs("id")&"</td>")
response.Write("</tr>")
response.Write("<tr>")
response.Write("<td>姓名:</td>"&"<td>"&rs("name")&"</td>")
response.Write("</tr>")
response.Write("<tr>")
response.Write("<td>留言:</td>"&"<td>"&rs("ly")&"</td>")
response.Write("</tr>")
response.Write("<tr>")
response.Write("<td>性别:</td>"&"<td>"&rs("sex")&"</td>")
response.Write("</tr>")
a=a+1
if a>listnum then exit do
rs.movenext
response.Write("</table>")
loop
end sub
%>
<%
function showpage(totalnumber,listnum,filename)
dim n
if totalnumber mod listnum=0 then
n=totalnumber \ listnum
else
n=totalnumber \ listnum + 1
end if
response.write "<form method=post action="&filename&">"
response.write " "
if CurrentPage<2 then
response.write "<font color='#000080'>首页 上一页</font> "
else
response.write "<a href="&filename&"?page=1>首页</a> "
response.write "<a href="&filename&"?page="&CurrentPage-1&">上一页</a> "
end if
if n-currentpage<1 then
response.write "<font color='#000080'>下一页 尾页</font>"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)&">下一页</a> "
response.write "<a href="&filename&"?page="&n&">尾页</a>"
end if
response.write "<font color='#000080'> 共<b>"&totalput&"</b>条留言 每页<b>"&listnum&"</b>条留言</font> "
'response.write "<font color='#000080'>转到:</font><input class=smallInput type='text' name='page' size=4 maxlength=10 value="&Currentpage&">"
'response.write "<input class=buttonface type='submit' value='Go' name='cndok'></form>"
end function
%>

搜索更多相关主题的帖子: Microsoft DSNtemp 留言 Driver 
2007-10-10 17:30
威龙嘉少
Rank: 1
等 级:新手上路
帖 子:205
专家分:0
注 册:2007-9-24
收藏
得分:0 
你的的确比我的科学啊,学习了,哈哈,谢谢啊,可以在问有个问题吗?用DW做分页处理的时候总是出现:
错误类型:
ADODB.Field (0x80020009)
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
版主有没有什么高见,可是不出现这样的错误提示啊,这主要是应为数据库里没有数据的缘故,难到就不能象编程一样实现,没有数据的时候显示,还没有任何留言吗?
2007-10-10 18:30
威龙嘉少
Rank: 1
等 级:新手上路
帖 子:205
专家分:0
注 册:2007-9-24
收藏
得分:0 
DW可以与数据库连接的啊,而且做ASP也很好啊,不知道你有什么好的工具?
2007-10-11 21:17
快速回复:[求助]非常郁闷的问题
数据加载中...
 
   



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

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