asp中查询分页不能保存条件,点下一页就提示没有记录
<%danweimingcheng=Request("danweimingcheng")dimconn,pageno,mypagedimconnstrconnstr="D...
<%
danweimingcheng=Request("danweimingcheng")
dim conn, pageno, mypage
dim connstr
connstr="DBQ="+server.mappath("crmdb.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
Set conn=Server.CreateObject("ADODB.CONNECTION")
conn.open connstr
mypage=20
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from danweibiao where quyu='"& danweimingcheng &"'"
response.write sql
rs.open sql,conn,3,1
if rs.eof then
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write"还没有这个客户"%>
//<a href='tianjia.htm'><%="请你给我们添几个吧!"%></a>
<%response.end%>
<% else
rs.pagesize=int(mypage)
pageno=request.querystring("pageno")
tsum=int(rs.recordcount/mypage*-1)*-1
rowcount=rs.pagesize
end if
pageno=cint(pageno)
if pageno="" or pageno<=1 then
pageno=1
end if
rs.absolutepage=pageno
%>
<table align="center" border="0" width="100%" cellspacing="0" cellpadding="0" height="18">
<tr>
<td width="500" height="12"> <font align="left" color="#800080" size="2">单位信息表
<a href="tianjia.htm">添加客户信息</a> </font></td>
<td width="500" height="12"> <font color="#800080" size="2"><% response.write "查询条件:区域="
response.write danweimingcheng %>
<%
if pageno=1 then response.write"上一页"
if pageno>1 then response.write"<a href='chaxun.asp?&pageno="&pageno-1&"'>上一页</a> "
if pageno<tsum then response.write" <a href='chaxun.asp?&pageno="&pageno+1&"'>下一页</a> "
if pageno=tsum then response.write"下一页"
response.write "共计:"
response.write tsum
response.write "页"
response.write "当前第"
response.write pageno
response.write "页"
%> <%
do while not rs.eof and rowcount>0
%>
<tr style="border:1px solid">
<td width="200"> <%=rs("danweimingcheng")%></td>
<td width="50"> <%=rs("leibie")%></td>
<td width="50"> <%=rs("sheng")%></td>
<td width="50"> <%=rs("quyu")%></td>
<td width="150"> <%=rs("adress")%></td>
<td width="50"> <%=rs("youbian")%></td>
<td width="50"> <%=rs("jingfei")%></td>
<td width="200"> <%=rs("beizhu")%></td>
<td width="100"> <a href="xiugaidanwei1.asp?id=<%=rs("id")%>">编辑</a> <a href="shandanwei.asp?id=<%=rs("id")%>">删除</a></td>
</tr>
<%
rowcount=rowcount-1
rs.movenext
loop
set guest=nothing
set rs=nothing
%> 展开
danweimingcheng=Request("danweimingcheng")
dim conn, pageno, mypage
dim connstr
connstr="DBQ="+server.mappath("crmdb.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
Set conn=Server.CreateObject("ADODB.CONNECTION")
conn.open connstr
mypage=20
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from danweibiao where quyu='"& danweimingcheng &"'"
response.write sql
rs.open sql,conn,3,1
if rs.eof then
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write"还没有这个客户"%>
//<a href='tianjia.htm'><%="请你给我们添几个吧!"%></a>
<%response.end%>
<% else
rs.pagesize=int(mypage)
pageno=request.querystring("pageno")
tsum=int(rs.recordcount/mypage*-1)*-1
rowcount=rs.pagesize
end if
pageno=cint(pageno)
if pageno="" or pageno<=1 then
pageno=1
end if
rs.absolutepage=pageno
%>
<table align="center" border="0" width="100%" cellspacing="0" cellpadding="0" height="18">
<tr>
<td width="500" height="12"> <font align="left" color="#800080" size="2">单位信息表
<a href="tianjia.htm">添加客户信息</a> </font></td>
<td width="500" height="12"> <font color="#800080" size="2"><% response.write "查询条件:区域="
response.write danweimingcheng %>
<%
if pageno=1 then response.write"上一页"
if pageno>1 then response.write"<a href='chaxun.asp?&pageno="&pageno-1&"'>上一页</a> "
if pageno<tsum then response.write" <a href='chaxun.asp?&pageno="&pageno+1&"'>下一页</a> "
if pageno=tsum then response.write"下一页"
response.write "共计:"
response.write tsum
response.write "页"
response.write "当前第"
response.write pageno
response.write "页"
%> <%
do while not rs.eof and rowcount>0
%>
<tr style="border:1px solid">
<td width="200"> <%=rs("danweimingcheng")%></td>
<td width="50"> <%=rs("leibie")%></td>
<td width="50"> <%=rs("sheng")%></td>
<td width="50"> <%=rs("quyu")%></td>
<td width="150"> <%=rs("adress")%></td>
<td width="50"> <%=rs("youbian")%></td>
<td width="50"> <%=rs("jingfei")%></td>
<td width="200"> <%=rs("beizhu")%></td>
<td width="100"> <a href="xiugaidanwei1.asp?id=<%=rs("id")%>">编辑</a> <a href="shandanwei.asp?id=<%=rs("id")%>">删除</a></td>
</tr>
<%
rowcount=rowcount-1
rs.movenext
loop
set guest=nothing
set rs=nothing
%> 展开
3个回答
展开全部
<%
if pageno=1 then response.write"上一页"
if pageno>1 then response.write"<a href='chaxun.asp?&pageno="&pageno-1&"'>上一页</a> "
if pageno<tsum then response.write" <a href='chaxun.asp?&pageno="&pageno+1&"'>下一页</a> "
if pageno=tsum then response.write"下一页"
response.write "共计:"
response.write tsum
response.write "页"
response.write "当前第"
response.write pageno
response.write "页"
%> 要想翻页获取到查询的结果。。。'chaxun.asp?&pageno="&pageno+1&"'这里还要传值 这个值就是你查询的条件,比如你查询的是关键字KEY的值那么这里该写成'chaxun.asp?&pageno="&pageno+1&"&key="&key的值&"'
if pageno=1 then response.write"上一页"
if pageno>1 then response.write"<a href='chaxun.asp?&pageno="&pageno-1&"'>上一页</a> "
if pageno<tsum then response.write" <a href='chaxun.asp?&pageno="&pageno+1&"'>下一页</a> "
if pageno=tsum then response.write"下一页"
response.write "共计:"
response.write tsum
response.write "页"
response.write "当前第"
response.write pageno
response.write "页"
%> 要想翻页获取到查询的结果。。。'chaxun.asp?&pageno="&pageno+1&"'这里还要传值 这个值就是你查询的条件,比如你查询的是关键字KEY的值那么这里该写成'chaxun.asp?&pageno="&pageno+1&"&key="&key的值&"'
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<%
if
pageno=1
then
response.write"上一页"
if
pageno>1
then
response.write"<a
href='chaxun.asp?&pageno="&pageno-1&"'>上一页</a>
"
if
pageno<tsum
then
response.write"
<a
href='chaxun.asp?&pageno="&pageno+1&"'>下一页</a>
"
if
pageno=tsum
then
response.write"下一页"
response.write
"共计:"
response.write
tsum
response.write
"页"
response.write
"当前第"
response.write
pageno
response.write
"页"
%>
要想翻页获取到查询的结果。。。'chaxun.asp?&pageno="&pageno+1&"'这里还要传值
这个值就是你查询的条件,比如你查询的是关键字KEY的值那么这里该写成'chaxun.asp?&pageno="&pageno+1&"&key="&key的值&"'
if
pageno=1
then
response.write"上一页"
if
pageno>1
then
response.write"<a
href='chaxun.asp?&pageno="&pageno-1&"'>上一页</a>
"
if
pageno<tsum
then
response.write"
<a
href='chaxun.asp?&pageno="&pageno+1&"'>下一页</a>
"
if
pageno=tsum
then
response.write"下一页"
response.write
"共计:"
response.write
tsum
response.write
"页"
response.write
"当前第"
response.write
pageno
response.write
"页"
%>
要想翻页获取到查询的结果。。。'chaxun.asp?&pageno="&pageno+1&"'这里还要传值
这个值就是你查询的条件,比如你查询的是关键字KEY的值那么这里该写成'chaxun.asp?&pageno="&pageno+1&"&key="&key的值&"'
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
C盘存的东西太多了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |