日期:2014-05-17  浏览次数:21110 次

求助分页不正常
从查询页选择查询条件后,跳转到本页,可以查询到结果,下部三个文本框内的值也是对的,得到的where语句是where tgyc='事故不明' and qukuai_id=1and youtian_id=1 ,点击下一页后,查询结果就成了空,wwhere语句变成了where tgyc <> ''and tgyc is not null and youtian_id= 

<% syoutian=trim(request.form("fyoutian"))
  if syoutian="==请选择油田==" then
  s1youtian=""
else
s1youtian="and youtian_id="&syoutian
end if  
  squkuai=trim(request.form("fqukuai"))
  if squkuai="==请选择区块==" or squkuai="" then
  s1qukuai=""
else
s1qukuai=" and qukuai_id="&squkuai
end if  
  stgyc=trim(request.form("tgyc"))
  if stgyc="" then
if s1youtian="" then
s1tgyc=" where tgyc <> '' and tgyc is not null"
end if
else
  s1tgyc="where tgyc='"&stgyc&"'"
end if  
  sxh=1
  skey=s1tgyc&s1qukuai&s1youtian
set rs=server.createobject("adodb.recordset")
sql="select * from ziliao "& skey &" order by jinghao DESC"
rs.open sql,conn,1,1
if rs.eof and rs.bof then %> 
共有<span style="color: #FF0000"><%=totalput%></span>条符合查询条件的记录,查询条件为:<%=skey%>
<form Action="brow-taoguanyichang.asp" Method="post" align="right">
  <table border="0" width="600" cellspacing="0" cellpadding="0" height="30">
  <tr>
  <td width="100%" height="30"> 
  <p align="center"><% 
  If currentPage <> 1 Then
  Response.Write "<A HREF=brow-taoguanyichang.asp?Page=" & showpages & ">[第一页]</A> "
  Response.Write "<A HREF=brow-taoguanyichang.asp?Page=" & (currentPage-1) & ">[上一页]</A> "
  End If
  If currentPage <> rs.PageCount Then
  Response.Write "<A HREF=brow-taoguanyichang.asp?Page=" & (currentPage+1) & ">[下一页]</A> "
  Response.Write "<A HREF=brow-taoguanyichang.asp?Page=" & totalPage & ">[最后一页]</A> "
  End If
%> 第<font color="#FF0000"><%=currentPage%></font>页,共<font color="#FF0000"><%=totalPage%></font>页 
  <% response.write " 转到:<select name='page' size=1 class=smallselsect style='BACKGROUND-COLOR:#FFE7B3;font-family: 宋体; font-size: 9pt;'>"

for i=1 to n
  response.write "<option value="& i 
  if currentpage=i then 
  response.write " selected"
  end if
  response.write ">"& i &"</option>"
next
  response.write "</select>" %>
<input name="fyoutian" type="hidden" value="<%=syoutian%>">
<input name="fqukuai" type="hidden" value="<%=squkuai%>">
<input name="tgyc" type="hidden" value="<%=stgyc%>">
  <%response.write "&nbsp;<input class=buttonface type='submit' value='确定' name='cndok' style='font-family: 宋体; font-size: 9pt;'>"%>  
  </td>
  </tr>
  </table>
</form>


------