| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 346 人关注过本帖
标题:分页进入了死循环。。请问这是哪里出错了?怎么改。。
只看楼主 加入收藏
hhh361
Rank: 1
等 级:新手上路
帖 子:64
专家分:0
注 册:2007-1-16
收藏
 问题点数:0 回复次数:0 
分页进入了死循环。。请问这是哪里出错了?怎么改。。

我的分页进入了死循环 不知道该怎么改。。就是按“上一页”“下一页"的时候就提示msgbox的内容了。。。
请帮忙修改一下。。

<%

dim Conn, sqlstr,key,temp
key=request("t1")
key2=request("t2")
key3=request("t3")


if key="" and key2="" and key3="" then%>
<script language="vbScript">msgbox "请至少输入一个查询条件!"
window.history.go(-1)
</script>
<% response.End()
end if

set Conn=server.CreateObject ("adodb.connection")
Conn.open "driver={Microsoft Access Driver (*.mdb)};dbq="&server.mappath("customer.mdb")

set rs=server.CreateObject("adodb.recordset")

if (key="" and key2=""and key3<>"") or (key="" and key2<>""and key3="")or(key<>"" and key2=""and key3="") then
sqlstr="select * from customer where customername='"&key&"' or logo='"&key2&"' or singsdate='"&key3&"' "

elseif key="" and key2<>""and key3<>"" then
sqlstr="select * from customer where logo='"&key2&"' and singsdate='"&key3&"' "

elseif key<>"" and key2=""and key3<>"" then
sqlstr="select * from customer where customername='"&key&"' and singsdate='"&key3&"' "

elseif key<>"" and key2<>"" and key3="" then
sqlstr="select * from customer where customername='"&key&"' and logo='"&key2&"' "

elseif key<>"" and key2<>"" and key3<>"" then
sqlstr="select * from customer where customername='"&key&"' and logo='"&key2&"' and singsdate='"&key3&"' "

else
end if


rs.Open sqlstr, conn,1,1


if rs.recordcount=0 then%>
<script language="vbScript">msgbox "sorry!未找到相关记录!"
window.history.go(-1)
</script>
<% else
end if





rs. PageSize = 1 '指定了每页要显示的记录条数为10
Page = Cint (Request("Page")) 'string型转化为整型
If Page < 1 Then Page = 1 '如果页码<1,将页码置为首页
'如果页码>1,将页码置为最后页
If Page > rs.PageCount Then Page = rs.PageCount
rs. AbsolutePage = Page '把页码赋给当前页
If Page <> 1 Then
Response.Write "<A HREF=chaxun.asp?Page=1>第一页 </A>"
Response.Write "<A HREF=chaxun.asp?Page="&(page-1)&"> 上一页</A>"
End If
If Page <> rs.PageCount Then
Response.Write "<A HREF=chaxun.asp?Page="&(page+1)&"> 下一页</A>"
Response.Write "<A HREF=chaxun.asp?Page="&rs.PageCount & "> 最后一页</A>"
End If
Response.write"页码:" & Page & "/" & rs.PageCount
'循环显示每条记录
For iPage = 1 To rs.PageSize

%>


<table align="center" border="1" bordercolor="black" >

<tr><td width=100 height=50>客户姓名:<%=rs("customername")%>


<td width=100 height=50>做货样式:<%=rs("goodstype")%></td>

<td width=100 height=50>LOGO:<%=rs("LOGO")%></td>

<td width=100 height=50>签单日期:<%=rs("singsdate")%></td>

<td width=100 height=50>预约提货时间:<%=rs("tgdate")%></td>

<td width=100 height=50>报价:<%=rs("bprice")%><%=rs("d2")%></td>

<td width=100 height=50>成交单价:<%=rs("sjprice")%><%=rs("d3")%></td>

<td width=100 height=50>数量:<%=rs("t1")%><%=rs("d1")%></td>
</table>

<%

rs.MoveNext
'如果记录读完,退出循环
If rs.EOF Then Exit For
Next
rs.close
set rs=nothing%>

搜索更多相关主题的帖子: request 
2007-04-16 16:28
快速回复:分页进入了死循环。。请问这是哪里出错了?怎么改。。
数据加载中...
 
   



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

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