我的分页进入了死循环 不知道该怎么改。。就是按“上一页”“下一页"的时候就提示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%>