asp查询分页
<!--#includefile="../inc/function.asp"--><!--#includefile="conn.asp"--><!--#includefi...
<!--#include file="../inc/function.asp"-->
<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->
<!--#include file="isadmin.asp"-->
<!--#include file="error.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>固定资产管理</title>
</head>
<body>
<link href="css.css" rel="stylesheet" type="text/css" />
<table width="100%" class="tableBorder">
<tr><td colspan="8"class="title">宿舍固定资产管理</td></tr>
<form name="form1" action="gl_gdzc.asp?action=chaxun" method="post">
<tr><td colspan="8">固定资产查询:<%call sushe()%><input type="text" name="keyword" />
<input type="submit" name="ok" value="查询" /></td></tr>
</form>
<tr><td width="9%" class="table">校区</td>
<td width="7%" class="table">楼层</td>
<td width="5%" class="table">宿舍</td>
<td width="13%" class="table">名称</td>
<td width="10%" class="table" >规格</td>
<td width="23%" class="table">数量</td>
<td width="20%" class="table">备注</td>
<td width="13%" class="table">管理</td>
</tr>
<%filepath=request.servervariables("path_info")%>
<%
set rs=server.CreateObject("adodb.recordset")
cx_xiaoqu=request("xiaoqu")
sushe_id=request("zhuang")
cx_sushe=request("sushe")
keywd=request("keyword")
set rs1=server.CreateObject("adodb.recordset")
sql1="select sushe_name from sushe where sushe_id="&cint(sushe_id)
rs1.open sql1,conn,1,3
cx_zhuang=rs1("sushe_name")
set rs1=nothing
sql="select * from guding where guding_id is not null "
if keywd <>"" then
sql=sql&" and(guding_name like '%"&keywd&"%' or guding_guige like '%"&keywd&"%' or guding_shuliang like '%"&keywd&"%' )"
end if
if cx_xiaoqu <>"" then
sql=sql&" and xiaoqu='"&cx_xiaoqu&"'"
end if
if cx_zhuang <>"" then
sql=sql&" and zhuang='"&cx_zhuang&"'"
end if
if cx_sushe <>"" then
sql=sql&" and sushe='"&cx_sushe&"'"
end if
sql=sql&"order by xiaoqu,zhuang,sushe"
rs.open sql,conn,1,3
rs.pagesize=2
mypage=rs.pagesize
page=clng(request.QueryString("page"))
if page<1 then
page=1
end if
if page>rs.pagecount then
page=rs.pagecount
end if
rs.absolutepage=page
do while not rs.eof and mypage > 0
%>
<tr><td><%=rs("xiaoqu")%></td><td><%=rs("zhuang")%></td><td><%=rs("sushe")%></td><td><%=rs("guding_name")%></td><td><%=rs("guding_guige")%></td><td><%=rs("guding_shuliang")%></td><td><%=rs("guding_bz")%></td><td>修改 删除 </td></tr>
<%
mypage=mypage-1
i=i+1
rs.move(pagesize)
loop
if rs.eof and rs.bof then
%>
<tr>
<td align="center" colspan="8">没有记录!</td>
</tr>
<%
end if
%>
</table>
<%
if page<>1 then%>
<a href="gl_gdzc.asp?page=1&cx_xiaoqu=<%=request("iaoqu")%>&cx_zhuang=<%=request("zhuang")%>&cx_sushe=<%=request("sushe")%>&cx_keywd=<%=request("keyword")%>"> 第一页</a>
<a href="gl_gdzc.asp?page=<%=request("page")-1%>&cx_xiaoqu=<%=request("xiaoqu")%>&cx_zhuang=<%=request("zhuang")%>&cx_sushe=<%=request("sushe")%>&cx_keywd=<%=request("keywd")%>"> 上一页</a>
<%end if%>
<%if page<>rs.pagecount then%>
<a href="gl_gdzc.asp?page=<%=request("page")+1%>&cx_xiaoqu=<%=request("xiaoqu")%>&cx_zhuang=<%=request("zhuang")%>&cx_sushe=<%=request("sushe")%>&cx_keywd=<%=request("keyword")%>"> 下一页</a>
<a href="gl_gdzc.asp?page=<%=rs.pagecount%>&cx_xiaoqu=<%=request("xiaoqu")%>&cx_zhuang=<%=request("zhuang")%>&cx_sushe=<%=request("sushe")%>&cx_keywd=<%=request("keyword")%>"> 最后一页</a>
<%
end if
%>
麻烦 大家帮我看看,查询分页的时候第一页显示正常,但点下一页的时候就回到咯没有查询的状态!谢谢! 展开
<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->
<!--#include file="isadmin.asp"-->
<!--#include file="error.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>固定资产管理</title>
</head>
<body>
<link href="css.css" rel="stylesheet" type="text/css" />
<table width="100%" class="tableBorder">
<tr><td colspan="8"class="title">宿舍固定资产管理</td></tr>
<form name="form1" action="gl_gdzc.asp?action=chaxun" method="post">
<tr><td colspan="8">固定资产查询:<%call sushe()%><input type="text" name="keyword" />
<input type="submit" name="ok" value="查询" /></td></tr>
</form>
<tr><td width="9%" class="table">校区</td>
<td width="7%" class="table">楼层</td>
<td width="5%" class="table">宿舍</td>
<td width="13%" class="table">名称</td>
<td width="10%" class="table" >规格</td>
<td width="23%" class="table">数量</td>
<td width="20%" class="table">备注</td>
<td width="13%" class="table">管理</td>
</tr>
<%filepath=request.servervariables("path_info")%>
<%
set rs=server.CreateObject("adodb.recordset")
cx_xiaoqu=request("xiaoqu")
sushe_id=request("zhuang")
cx_sushe=request("sushe")
keywd=request("keyword")
set rs1=server.CreateObject("adodb.recordset")
sql1="select sushe_name from sushe where sushe_id="&cint(sushe_id)
rs1.open sql1,conn,1,3
cx_zhuang=rs1("sushe_name")
set rs1=nothing
sql="select * from guding where guding_id is not null "
if keywd <>"" then
sql=sql&" and(guding_name like '%"&keywd&"%' or guding_guige like '%"&keywd&"%' or guding_shuliang like '%"&keywd&"%' )"
end if
if cx_xiaoqu <>"" then
sql=sql&" and xiaoqu='"&cx_xiaoqu&"'"
end if
if cx_zhuang <>"" then
sql=sql&" and zhuang='"&cx_zhuang&"'"
end if
if cx_sushe <>"" then
sql=sql&" and sushe='"&cx_sushe&"'"
end if
sql=sql&"order by xiaoqu,zhuang,sushe"
rs.open sql,conn,1,3
rs.pagesize=2
mypage=rs.pagesize
page=clng(request.QueryString("page"))
if page<1 then
page=1
end if
if page>rs.pagecount then
page=rs.pagecount
end if
rs.absolutepage=page
do while not rs.eof and mypage > 0
%>
<tr><td><%=rs("xiaoqu")%></td><td><%=rs("zhuang")%></td><td><%=rs("sushe")%></td><td><%=rs("guding_name")%></td><td><%=rs("guding_guige")%></td><td><%=rs("guding_shuliang")%></td><td><%=rs("guding_bz")%></td><td>修改 删除 </td></tr>
<%
mypage=mypage-1
i=i+1
rs.move(pagesize)
loop
if rs.eof and rs.bof then
%>
<tr>
<td align="center" colspan="8">没有记录!</td>
</tr>
<%
end if
%>
</table>
<%
if page<>1 then%>
<a href="gl_gdzc.asp?page=1&cx_xiaoqu=<%=request("iaoqu")%>&cx_zhuang=<%=request("zhuang")%>&cx_sushe=<%=request("sushe")%>&cx_keywd=<%=request("keyword")%>"> 第一页</a>
<a href="gl_gdzc.asp?page=<%=request("page")-1%>&cx_xiaoqu=<%=request("xiaoqu")%>&cx_zhuang=<%=request("zhuang")%>&cx_sushe=<%=request("sushe")%>&cx_keywd=<%=request("keywd")%>"> 上一页</a>
<%end if%>
<%if page<>rs.pagecount then%>
<a href="gl_gdzc.asp?page=<%=request("page")+1%>&cx_xiaoqu=<%=request("xiaoqu")%>&cx_zhuang=<%=request("zhuang")%>&cx_sushe=<%=request("sushe")%>&cx_keywd=<%=request("keyword")%>"> 下一页</a>
<a href="gl_gdzc.asp?page=<%=rs.pagecount%>&cx_xiaoqu=<%=request("xiaoqu")%>&cx_zhuang=<%=request("zhuang")%>&cx_sushe=<%=request("sushe")%>&cx_keywd=<%=request("keyword")%>"> 最后一页</a>
<%
end if
%>
麻烦 大家帮我看看,查询分页的时候第一页显示正常,但点下一页的时候就回到咯没有查询的状态!谢谢! 展开
1个回答
展开全部
keywd=request("keyword")
if keywd <>"" then
sql=sql&" and(guding_name like '%"&keywd&"%' or guding_guige like '%"&keywd&"%' or guding_shuliang like '%"&keywd&"%' )"
end if
如果我没有看错的话 你这个keywd变量没有传对
排错的时候个可以输出变量看看哪个没有传回来
<a href="gl_gdzc.asp?page=<%=request("page")+1%>&cx_xiaoqu=<%=request("xiaoqu")%>&cx_zhuang=<%=request("zhuang")%>&cx_sushe=<%=request("sushe")%>&cx_keywd=<%=request("keyword")%>"> 下一页</a>
这里是cx_keywd 上面接收的时候是 keywd=request("keyword")
if keywd <>"" then
sql=sql&" and(guding_name like '%"&keywd&"%' or guding_guige like '%"&keywd&"%' or guding_shuliang like '%"&keywd&"%' )"
end if
如果我没有看错的话 你这个keywd变量没有传对
排错的时候个可以输出变量看看哪个没有传回来
<a href="gl_gdzc.asp?page=<%=request("page")+1%>&cx_xiaoqu=<%=request("xiaoqu")%>&cx_zhuang=<%=request("zhuang")%>&cx_sushe=<%=request("sushe")%>&cx_keywd=<%=request("keyword")%>"> 下一页</a>
这里是cx_keywd 上面接收的时候是 keywd=request("keyword")
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询