| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 768 人关注过本帖
标题:[求助]我的分页有问题,希望大家看看,谢谢了
只看楼主 加入收藏
fengjian
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2006-7-29
收藏
 问题点数:0 回复次数:6 
[求助]我的分页有问题,希望大家看看,谢谢了

<!--#include file="head.asp"-->
<!--#include file="conn.asp"--> <!--"../"表示上一级目录-->
<!--#include file="function.asp"-->
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from detail"
rs.open sql,conn,1,1
mypage=request("mypage") '传值出错,接受不到,检查不出
filename="show.asp"
howmany=rs.recordcount
if mypagesize="" then
mypagesize=5
end if
if IsEmpty(mypage) then
mypage=1
elseif mypage>mypagecount then
mypage=mypagecount
end if
rs.pagesize=mypagesize
mypagecount=cint(rs.pagecount) '页数出问题,每页5条记录,应该4页,却只有2页
mypage=cint(mypage)
rs.absolutepage=mypage '这里是26行
%>

<hr width="80%" size="1" noshade color="#45DE4D">
<table width="80%" height="354" border="0" align="center">
<tr>
<td height="350" valign="top"><table width="100%" border="0" cellspacing="0" class="hstyle1">
<tr bgcolor="FCDAD5" class="style1">
<td width="324" height="21" bgcolor="FCDAD5" class="hstyle1">总留言数:
<% response.Write(howmany)%> 总页数:<% response.Write(mypagecount)%>页</td>
<td width="444" rowspan="2" bgcolor="#FFDAB9"></td>
</tr>
<tr bgcolor="C9E4D6" class="style1">
<td height="21" bgcolor="C9E4D6"><div align="left">回首页</div></td>
</tr>
</table>
<table width="100%" height="4%" border="0.5" cellpadding="0" cellspacing="0" bordercolor="#333333" class="hstyle1">
<tr class="style1">
<td width="61" height="24"><div align="center">状态</div></td>
<td width="61" height="24"><div align="center">心情</div></td>
<td width="227" height="24"><div align="center">发言主题</div></td>
<td width="129" height="24"><div align="center">发言者</div></td>
<td width="64" headers="24"><div align="center">发表时间</div></td>
<td width="46" height="24"><div align="center">回复</div></td>
<td width="46" height="24"><div align="center">阅读</div></td>
<td width="138" height="24"><div align="center">最后回复</div></td>
</tr>
</table>
<%

do while not rs.eof and howmanyrecs< rs.pagesize
%>
<table width="100%" height="3%" border="0" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC" class="hstyle1">
<tr class="style1">
<td width="61" height="25"><div align="center"></div></td>
<td width="61" height="25"><div align="center"></div></td>
<td width="227" height="25"><div align="center"></div>
<div align="left"><%=rs("theme")%></div></td>
<td width="129" height="25"><div align="center"><%=rs("name")%></div></td>
<td width="64" headers="24"><div align="center"><%=rs("publishtime")%></div></td>
<td width="46" height="25"><div align="center"></div></td>
<td width="46" height="25"><div align="center"></div></td>
<td width="138" height="25"><div align="center"></div></td>
</tr>
</table>
<%
rs.movenext
howmanyrecs=howmanyrecs+1
loop
rs.close
%>
<form name="form1" method="post" action="">
<table width="100%" height="30" border="0" class="hstyle1">
<tr> <!--以下调用function页面的sub page-->
<td height="26" class="style1"><div align="right"><% call page(filename,mypage,mypagecount)%> 跳到第
<input name="pmypage" type="text" id="pmypage" value="1" size="3" height="15">

<input type="submit" name="Submit" value="GO">
</div></td>
</tr>
</table>
</form></td>
</tr>
</table>

调用的page函数:
sub page(filename,mypage,mypagecount)
dim str
str="您当前在第"&mypage&"页"
if (mypage="" or mypage=1) then
str=str&"首页 | 上一页"
elseif mypage>1 then
str=str&"<a href='"&filename&"?mypage=1'>首页</a> | <a href='"&filename&"?mypage="&mypage-1&"'>上一页</a>"
end if
if mypage=mypagecount then
str=str& " | 下一页 | 尾页"
elseif mypage<mypagecount then
str=str&" | <a href='"&filename&"?mypage="&mypage+1&"'>下一页</a> | <a href='"&filename&"?mypage="&mypagecount&"'>尾页</a>"
end if
response.Write(str)
end sub
%>

F12运行时能显示,但是点下一页时就提示
ADODB.Recordset (0x800A0BB9)
参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。
/visitor's book/visitor's book/show.asp, 第 26 行 就是rs.absolutepage=mypage
好象没接受到值,我该怎么修改呢?请各位帮忙看一下好吗?谢谢了~~!

搜索更多相关主题的帖子: request include detail file 
2006-12-11 01:34
zsf2006
Rank: 1
来 自:博客园
等 级:新手上路
威 望:1
帖 子:315
专家分:0
注 册:2006-6-3
收藏
得分:0 
好象没接受到值
<form name="form1" method="post" action="">改为

<form name="form1" method="post" action="show.asp">

光临我的博客:http://
2006-12-11 09:32
fengjian
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2006-7-29
收藏
得分:0 
加了~~还是不行,默认为本页的,还是同样的错误,谢谢再看一下~
2006-12-11 14:30
fengjian
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2006-7-29
收藏
得分:0 
帮帮忙~~谢谢了~~
2006-12-11 18:05
zsf2006
Rank: 1
来 自:博客园
等 级:新手上路
威 望:1
帖 子:315
专家分:0
注 册:2006-6-3
收藏
得分:0 
得,我给你一个,你看着改吧
=====================================================
<!--#include file="inc/opencnn.asp"-->
<%
dim rs,sql
dim pageno
dim tallpage
set rs=server.CreateObject("adodb.recordset")
sql="select * from student"
rs.open sql,conn,1,1
rs.pagesize=5

pageno=request("pageno")
if isnumeric(pageno)=false then
pageno=1
else
pageno=cint(pageno)
end if

%>
<script language="JavaScript">
<!--
function go_menu(menu)
{
var k=menu.selectedIndex;
frm.pageno.value=menu.options[k].value;
frm.submit();
}
-->
</script><title>分页--跳转--Go--</title>
<style>
td {
font-size: 10pt;
color: #000000;
text-decoration: none;
}
a:link {
font-size: 10pt;
color: #FF0000;
text-decoration: none;
}
a:visited {
font-size: 10pt;
color: #FF0000;
text-decoration: none;
}
a:hover {
font-size: 10pt;
color: #333333;
text-decoration: none;
}

</style>

<table width="600" height="57" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#2A79BB">
<tr bgcolor="#dbeffb">
<td width="88" height="26"><strong>ID</strong></td>
<td width="312"><strong>name</strong></td>
<td width="200"><strong>age</strong></td>
</tr>
<%
tallpage=(rs.recordcount-1)\rs.pagesize+1
if pageno > tallpage then
pageno = tallpage
else
if pageno < 1 then
pageno = 1
end if
end if
rs.AbsolutePage=pageno
for i=1 to rs.pagesize
dim tmpBgcolor
if (i mod 2)=1 then
tmpBgcolor="#ffffff"
else
tmpBgcolor="#f6f6f6"
end if
%>
<tr bgcolor="<%=tmpBgcolor%>">
<td><%=rs("id")%></td>
<td><%=rs("name")%></td>
<td><%=rs("age")%></td>
</tr>
<%
rs.movenext
if rs.eof then exit for
next
%>
</table>
<br>
<table width="600" height="39" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#2A79BB">
<tr>
<td bgcolor="#dbeffb">
<form name="frm" method="post" action="fenye.asp">
<a href="go.asp?pageno=1">首页</a>
<% if pageno<2 then%>
上一页
<%else%>
<a href="go.asp?pageno=<%=pageno-1%>">上一页</a>
<%end if%>
<%if pageno>=tallpage then%>
下一页
<%else%>
<a href="go.asp?pageno=<%=pageno+1%>">下一页</a>
<%end if%>
<%%>
<a href="go.asp?pageno=<%=tallpage%>">尾页</a> <font color=red><%=pageno%>/<%=tallpage%></font> 
<select name="yy" onChange="return go_menu(frm.yy);">
<%
for i=1 to tallpage
if pageno=i then
response.write"<option value=" & i & " selected>第" & i &"页</option>" 'selected前面要有空格
else
response.write"<option value=" & i & ">第" & i &"页</option>"
end if
next
%>
</select>
  跳到
<input name="pageno" type="text" size="5" value="<%=pageno%>">
<input type="submit" name="Submit" value="Go&gt;&gt;">
</form>
</td>
</tr>
</table>

光临我的博客:http://
2006-12-11 18:48
sdjnqprld
Rank: 1
等 级:新手上路
帖 子:29
专家分:0
注 册:2006-11-25
收藏
得分:0 
楼主的代码问题太多,经过删改,以下代码运行还可以,可作参考
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from detail"
rs.open sql,conn,1,1
mypage=request("mypage") filename="show.asp"
counts=5
rs.pagesize=counts
mypagecount=cint(rs.pagecount)
if not isnumeric(page) then page=1
if IsEmpty(mypage) or cint(mypage)<1 then
mypage=1
elseif cint(mypage)>=mypagecount then
mypage=mypagecount
end if
rs.absolutepage=mypage %>

<hr width="80%" size="1" noshade color="#45DE4D">
<table width="80%" height="354" border="0" align="center">
<tr>
<td height="350" valign="top"><table width="100%" border="0" cellspacing="0" class="hstyle1">
<tr bgcolor="FCDAD5" class="style1">
<td width="324" height="21" bgcolor="FCDAD5" class="hstyle1">总留言数:
<% response.Write(howmany)%> 总页数:<% response.Write(mypagecount)%>页</td>
<td width="444" rowspan="2" bgcolor="#FFDAB9"></td>
</tr>
<tr bgcolor="C9E4D6" class="style1">
<td height="21" bgcolor="C9E4D6"><div align="left">回首页</div></td>
</tr>
</table>
<table width="100%" height="4%" border="0.5" cellpadding="0" cellspacing="0" bordercolor="#333333" class="hstyle1">
<tr class="style1">
<td width="61" height="24"><div align="center">状态</div></td>
<td width="61" height="24"><div align="center">心情</div></td>
<td width="227" height="24"><div align="center">发言主题</div></td>
<td width="129" height="24"><div align="center">发言者</div></td>
<td width="64" headers="24"><div align="center">发表时间</div></td>
<td width="46" height="24"><div align="center">回复</div></td>
<td width="46" height="24"><div align="center">阅读</div></td>
<td width="138" height="24"><div align="center">最后回复</div></td>
</tr>
</table>
<%

do while (not rs.eof) and counts>0
%>
<table width="100%" height="3%" border="0" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC" class="hstyle1">
<tr class="style1">
<td width="61" height="25"><div align="center"></div></td>
<td width="61" height="25"><div align="center"></div></td>
<td width="227" height="25"><div align="center"></div>
<div align="left"><%=rs("theme")%></div></td>
<td width="129" height="25"><div align="center"><%=rs("name")%></div></td>
<td width="64" headers="24"><div align="center"><%=rs("publishtime")%></div></td>
<td width="46" height="25"><div align="center"></div></td>
<td width="46" height="25"><div align="center"></div></td>
<td width="138" height="25"><div align="center"></div></td>
</tr>
</table>

<%
rs.movenext
counts=counts-1
loop
rs.close
%>
<form name="form1" method="post" action="">
<table width="100%" height="30" border="0" class="hstyle1">
<tr> <!--以下调用function页面的sub page-->
<td height="26" class="style1"><div align="right">
<% dim str
str="您当前在第"&mypage&"页"
if (mypage=1) then
str=str&"首页 | 上一页"
else
str=str&"<a href="&filename&"?mypage=1>首页</a> | <a href="&filename&"?mypage="&mypage-1&">上一页</a>"
end if

if mypage=mypagecount then
str=str& " | 下一页 | 尾页"
else
str=str&" | <a href="&filename&"?mypage="&mypage+1&">下一页</a> | <a href="&filename&"?mypage="&mypagecount&">尾页</a>"
end if
response.Write(str)%>
跳到第
<input name="pmypage" type="text" id="pmypage" value="1" size="3" height="15">

<input type="submit" name="Submit" value="GO">
</div></td>
</tr>
</table>
</form></td>
</tr>
</table>




</body>
</html>

[此贴子已经被作者于2006-12-11 22:31:27编辑过]

2006-12-11 22:27
fengjian
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2006-7-29
收藏
得分:0 
谢谢哦~~谢谢大家了~大家真热心~!
2006-12-11 23:31
快速回复:[求助]我的分页有问题,希望大家看看,谢谢了
数据加载中...
 
   



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

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