| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 410 人关注过本帖
标题:不能实现查询分页功能!
只看楼主 加入收藏
qyf834100
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2007-9-12
收藏
 问题点数:0 回复次数:3 
不能实现查询分页功能!

高手帮忙! 查询页面不能实现分页功能! 当点击下一页时候 变出现:没有检索到任何产品,请返回.及是不能实现分页.代码如下:
1 查询页面代码:

<table border="0" cellpadding="0" cellspacing="0">
<form name="myform" action="sp_recarchresult.asp" method="post">
<%dim count
set rs=server.createobject("adodb.recordset")
rs.open "select * from pp order by pp_id ",conn,1,1%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("pp_name"))%>","<%= rs("pp_lbid")%>","<%= rs("pp_belongsortid")%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>

onecount=<%=count%>;

function changelocation(locationid)
{
document.myform.sj.length = 0;

var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][2] == locationid)
{
document.myform.sj.options[document.myform.sj.length] = new Option(subcat[i][0], subcat[i][1]);
}
}

}

//-->
</script>
<tr>
<td width="118" valign="middle" nowrap="nowrap"><img src="image/woyaozhao.gif" width="117" height="39" /></td>
<td width="571" valign="middle" nowrap="nowrap">&nbsp; 类别:
<%
rs.open "select * from sort order by order_id",conn,1,1
if rs.eof and rs.bof then
response.write "请先选择类别。"
response.end
else
%>
<select name="dl" size="1" id="dl" onChange="changelocation(document.myform.dl.options[document.myform.dl.selectedIndex].value)">
<option selected value="<%=rs("order_lbid")%>"><%=trim(rs("order_name"))%></option>
<%
dim selclass
selclass=rs("order_lbid")
rs.movenext
do while not rs.eof
%>
<option value="<%=rs("order_lbid")%>"><%=trim(rs("order_name"))%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
商家:
<select name="sj" id="sj">
<%rs.open "select * from pp where pp_belongsortid="&selclass ,conn,1,1
if not(rs.eof and rs.bof) then
%>
<option selected value="<%=rs("pp_lbid")%>"><%=rs("pp_name")%></option>
<% rs.movenext
do while not rs.eof
%>
<option value="<%=rs("pp_lbid")%>"><%=rs("pp_name")%></option>
<% rs.movenext
loop
end if
rs.close
set rs=nothing

%>
</select>
&nbsp;关键字:&nbsp;
<label>
<input name="keyword" type="text" size="20" maxlength="40" />
</label></td>
<td width="97" valign="middle" nowrap="nowrap"><input type="image" src="image/ss.gif" alt="搜索"/></td>
<td width="31" valign="middle"><img src="image/wh.gif" width="22" height="25" /></td>
<td width="52" valign="middle" nowrap="nowrap">如何搜索</td>
</tr>
</form>
</table>
2 处理查询页面代码
<%lb=trim(request.Form("dl"))
sj=trim(request.Form("sj"))
keyword=trim(request.Form("keyword"))
%>
<table width="917" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td colspan="3" height="33" background="image/tg_pp.jpg">&nbsp;</td>
</tr>
<tr>
<td width="7" background="image/tg_lb_b0.jpg">&nbsp;</td>
<td width="899">

<table width="250" height="47" border="1" align="center" cellpadding="9" cellspacing="9" bordercolor="#ffffff" >
<tr >
<%
set rs1=conn.execute("select * from pp where pp_belongsortid='"&lb&"' order by pp_id")
do while not rs1.eof
i=i+1
%>
<td align="center" bordercolor="#CCCCCC"><img src="<%=rs1("pp_imgurl")%>" width="148" height="40" alt="<%=rs1("pp_name")%>"/></td>
<%if i mod 5=0 then%>
</tr>
<% end if
rs1.movenext
loop
rs1.close()
set rs1=nothing
%>
</table>
</td>
<td background="image/tg_lb_b11.jpg" width="8">&nbsp;</td>
</tr>
<tr>
<td colspan="3"height="23"background="image/tg_b.jpg" >&nbsp;</td>
</tr>
</table>
<table width="917" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="33"background="image/wdcp.jpg">&nbsp;</td>
</tr>
<tr>
<td background="image/wdcp_xx.jpg" height="29">&nbsp;</td>
</tr>
<%
sql="select * from product where product_lbid='"&lb&"' and product_belongppid='"&sj&"' and product_name like '%"&keyword&"%' order by product_id desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
if rs.eof then

%>
<tr><td align="center" >没有检索到任何产品,请<a href="javascript:history.go(-1)">返回</a></td></tr>
<%else
rowcount=2
rs.pagesize=rowcount
counts=rs.recordcount
totalpage=rs.pagecount
currpage=request.form("page")
if not isnumeric(currpage) then error("<li>错误的Page参数;")
currpage=cINT(currpage)
if currpage<1 then
currpage=1
elseif currpage>totalpage then
currpage=totalpage
end if
rs.absolutepage=currpage
do while not rs.eof and rowcount>0

%>
<tr>
<td height="29">
<table width="100%" border="0">
<tr>
<SCRIPT language=JavaScript type=text/javascript>

function openMenu<%=rs("product_id")%>(){
if (document.getElementById){
document.getElementById("menu<%=rs("product_id")%>").style.visibility='visible';
}
}

function closeMenu<%=rs("product_id")%>(){

if (document.getElementById){
document.getElementById("menu<%=rs("product_id")%>").style.visibility='hidden';
}
}

</SCRIPT>
<td width="14%" align="center" onmouseover=openMenu<%=rs("product_id")%>() onmouseout=closeMenu<%=rs("product_id")%>()>
<DIV id=Layer1<%=rs("product_id")%> style="Z-INDEX: 1; right: -50px; WIDTH: 0px; POSITION: relative; TOP: 5px; HEIGHT: 0px">
<DIV id=menu<%=rs("product_id")%> style="Z-INDEX: 2; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px">

<table width="226" border="0" cellspacing="0" cellpadding="0" height="222">
<tr>
<td background="image/sp_xxb.jpg" width="226" height="222" align="center"><img src="<%=rs("product_url")%>" width="170" height="150" border="0" /></td>
</tr>
</table>
</DIV>
</DIV>
<a href="sp_list.asp?id=<%=rs("product_id")%>"><img src="<%=rs("product_url")%>" width="100" height="80" border="0" /></a></td>
<td width="30%" align="center"><%=rs("product_name")%></td>
<td width="12%" align="center"><%=rs("product_gg")%></td>
<td width="6%" align="center"><%=rs("product_order")%></td>
<td width="20%" align="center"><%=rs("product_place")%></td>
<td width="7%" align="center"><del><%=rs("product_price")%>.00</del></td>
<td width="11%"><font size="4" color="#F6881F"><%=rs("product_tprice")%>.00</font></td>
</tr>
<tr> <td colspan="7" background="image/sc_b.jpg" height="12"></td></tr>

</table>

</td>
</tr>
<%
rs.Movenext
rowcount=rowcount-1
loop

%>

<tr><td>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<form action="sp_recarchresult.asp?sj=<%=rs("product_belongppid")%>&lb=<%=rs("product_lbid")%>&keyword=<%=keyword%>" method="post">
<tr bordercolor="#F6881F" height=30><td width="28%" bgcolor="#F6881F" align="center" colspan="7">&nbsp;共<%=totalpage+0%>页 当前第<%=currpage+0%>页 共检索到<%=counts+0%>条</td><td width="72%" align=center bgcolor="#F6881F"><%if currpage<=1 then%>〖首页〗〖上一页〗<%else%>〖<a href='?page=1&sj=<%=rs("product_belongppid")%>&lb=<%=rs("product_lbid")%>&keyword=<%=keyword%>'>首页</a>〗〖<a href='?page=<%=currpage-1%>&sj=<%=rs("product_belongppid")%>&lb=<%=rs("product_lbid")%>&keyword=<%=keyword%>'>上一页</a>〗<%end if%><%if (totalpage-currpage)<=0 then%>〖下一页〗〖尾页〗<%else%>〖<a href='?page=<%=currpage+1%>&sj=<%=rs("product_belongppid")%>&lb=<%=rs("product_lbid")%>&keyword=<%=keyword%>'>下一页</a>〗〖<a href='?page=<%=totalpage%>&sj=<%=rs("product_belongppid")%>&lb=<%=rs("product_lbid")%>&keyword=<%=keyword%>'>尾页</a>〗<%end if%>&nbsp;转到<input name=page size=1 value="<%=currpage+0%>">页<input type=submit value="GO">&nbsp;
</td></tr></form></table></td></tr>
<%
rs.close
set rs=nothing
end if
%>
请问是哪里出问题了 请帮忙! 小第在这里先谢过了!

搜索更多相关主题的帖子: 查询 
2007-09-13 09:37
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
<%lb=trim(request.Form("dl"))
sj=trim(request.Form("sj"))
keyword=trim(request.Form("keyword"))
%>
这里加判断改为
<%
IF Request.Form("keyword")<>"" Then
lb=trim(request.Form("dl"))
sj=trim(request.Form("sj"))
keyword=trim(request.Form("keyword"))
Else
lb=trim(request("dl"))
sj=trim(request("sj"))
keyword=trim(request("keyword"))
End IF
%>
2007-09-13 11:24
qyf834100
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2007-9-12
收藏
得分:0 

谢谢 哈 看看行不

2007-09-13 11:31
qyf834100
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2007-9-12
收藏
得分:0 
还是不行啊 ! 还有什么办法没的 老大们?
2007-09-13 11:35
快速回复:不能实现查询分页功能!
数据加载中...
 
   



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

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