设为首页收藏本站

新微赢技术网

 找回密码
 注册
搜索
热搜: 回贴
查看: 71|回复: 8
打印 上一主题 下一主题

[求助]留言分页处理问题

[复制链接]
跳转到指定楼层
1#
发表于 2010-1-8 07:20:11 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
错误类型:
Microsoft VBScript 运行时错误 (0x800A000B)
被零除
/liuyan0.asp, 第 116 行

浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
这是我做留言分页处理的时候弹出的错误提示,有谁知道是怎么回师啊,帮帮忙,指教 下啊,谢谢:
第116行就是这句:if (totalput mod listnum )= 0 then
currentpage=totalput \ listnum
完整代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%
dim totalput
dim currentpage
dim totalpages
if not isempty(request.QueryString("page")) then
currentpage=cint(request.QueryString("page"))
else
currentpage=1
end if

%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
body,td,th {
font-size: 18px;
color: #FF0000;
}
body {
background-image: url(image/000.jpg);
background-repeat: repeat;
}
body {
background-attachment: fixed;
background-color: #CCCCCC;
background-image: url(image/000.jpg);
background-repeat: repeat;
}
-->
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="liuyan1.asp">
<table width="387" height="214" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FF0000">
<tr>
<td width="143" height="36">&nbsp;用户名:</td>
<td width="168"><label>
<input type="text" name="name" />
</label></td>
</tr>
<tr>
<td height="31">&nbsp;密&nbsp; 码:</td>
<td><label>
<input type="password" name="pwd" />
</label></td>
</tr>
<tr>
<td height="67">&nbsp;留&nbsp; 言:</td>
<td><label>
<textarea name="ly" cols="20"></textarea>
</label></td>
</tr>
<tr>
<td bordercolor="#FF0000">&nbsp;性&nbsp; 别:</td>
<td><label>
<input type="radio" name="sex" value="男" />

</label>
<label>
<input type="radio" name="sex" value="女" />
女</label></td>
</tr>
<tr>
<td colspan="2" bordercolor="#FF0000"><label>
<input type="submit" name="Submit" value="提交" />
</label>
<label>
<input type="reset" name="Submit2" value="重置" />
</label></td>
</tr>
</table>
<%
set conn=server.createobject("adodb.connection")
DSNtemp = "Driver={Microsoft Access Driver (*.mdb)};"
DSNtemp = DSNtemp & "DBQ=" & server.mappath("学生.mdb")
conn.open DSNtemp
set rs=conn.execute("select * from ly order by id desc")
if rs.eof and rs.bof then
response.Write("暂时还没有任何留言!")
else
response.Write("<div align='center'>")
do while not rs.eof
response.Write("<hr / color='blue' width='60%'>")
response.Write("<table border='1' bordercolor='red' width='60%'>")
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>")
rs.movenext
response.Write("</table>")
loop

response.Write("</div>")
end if
%>
<%
totalput=rs.recordcount
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=totalput \ listnum +1
end if
end if
if currentpage=1 then
showpage totalput,listnum,"liuyan0.asp"
if (currentPage-1)*listnum<totalPut then
rs.move (currentPage-1)*listnum
showpage totalput,listnum,"liuyan0.asp"
else
currentpage=1
showpage totalput,listnum,"liuyan0.asp"
end if
end if
rs.close
conn.close
set rs=nothing
set con=nothing
%>
</form>
<%
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>"&totalnumber&"</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
%>
<p>&nbsp;</p>
</body>
</html>
2#
发表于 2010-1-8 07:20:14 | 只看该作者
错误类型:Microsoft VBScript 运行时错误 (0x800A000B)被零除/liuyan0.asp, 第 116 行浏览器类型:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) 这是我做留言分页处理的时候弹出的错误提示,有谁知道是怎么回师啊,帮帮忙,指教 下啊,谢谢:第116行就是这句:
if (totalput mod listnum )= 0 then currentpage=totalput \ listnum
这是错误类型
回复 支持 反对

使用道具 举报

3#
发表于 2010-1-8 07:20:17 | 只看该作者
那要怎么搞才可以啊,请指教啊!
回复 支持 反对

使用道具 举报

4#
发表于 2010-1-8 07:20:20 | 只看该作者
if (currentpage-1)*listnum>totalput then
if (totalput mod listnum )= 0 then
currentpage=totalput \ listnum
else
currentpage=totalput \ listnum +1
end if
end if
if totalnumber mod listnum=0 then
n=totalnumber \ listnum
else
n=totalnumber \ listnum + 1
end if
很明显楼主这两处出的错误,其中listnum可能为0所以出现被0除错误。
回复 支持 反对

使用道具 举报

5#
发表于 2010-1-8 07:20:27 | 只看该作者
完整代码:
<%
set conn=server.createobject("adodb.connection")
DSNtemp = "Driver={Microsoft Access Driver (*.mdb)};"
DSNtemp = DSNtemp & "DBQ=" & server.mappath("学生.mdb")
conn.open DSNtemp
set rs=conn.execute("select * from ly order by id desc")
if rs.eof and rs.bof then
response.Write("暂时还没有任何留言!")
else
response.Write("<div align='center'>")
do while not rs.eof
response.Write("<hr / color='blue' width='60%'>")
response.Write("<table border='1' bordercolor='red' width='60%'>")
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>")
rs.movenext
response.Write("</table>")
loop

response.Write("</div>")
end if
%>
<%
totalput=rs.recordcount
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=totalput \ listnum +1
end if
end if
if currentpage=1 then
showpage totalput,listnum,"liuyan0.asp"
if (currentPage-1)*listnum<totalPut then
rs.move (currentPage-1)*listnum
showpage totalput,listnum,"liuyan0.asp"
else
currentpage=1
showpage totalput,listnum,"liuyan0.asp"
end if
end if
rs.close
conn.close
set rs=nothing
set con=nothing
%>
</form>
<%
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>"&totalnumber&"</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
%>
<p>&nbsp;</p>
</body>
</html>
回复 支持 反对

使用道具 举报

6#
发表于 2010-1-8 07:20:34 | 只看该作者
怎么贴上来就成了这样了,郁闷
回复 支持 反对

使用道具 举报

7#
发表于 2010-1-8 07:20:37 | 只看该作者
http://bbs.bc-cn.net/viewthread.php?tid=37557
还是推荐楼主去看看我写的分页类
回复 支持 反对

使用道具 举报

8#
发表于 2010-2-3 16:05:06 | 只看该作者
我现在终于明白我缺乏的是什么了,正是楼主那种对真理的执着追求和楼主那种对理想的艰苦实践所产生的厚重感。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

申请友链|小黑屋|最新主题|手机版|新微赢技术网 ( 苏ICP备08020429号 )  

GMT+8, 2024-11-20 09:21 , Processed in 0.105499 second(s), 9 queries , Gzip On, Memcache On.

Powered by xuexi

© 2001-2013 HaiAn.Com.Cn Inc. 寰耽

快速回复 返回顶部 返回列表