查询分页问题,急!
在输入条件查询后,查询结果正常,但点击下一页后,就变成了显示全部数据的状况了,参数我也传了,就是不知道错哪里了,搞了好长时间,望好心人帮改一改,万分感激!<table border=1 cellspacing="1" bgcolor="#336699" align=center>
<form action="index.asp?action=sortlist" method="post" name="ReNew">
<TR>
<TD colspan="10" align="right" valign="middle" bgcolor="#DDDDDD" > <select name="S_SearchOption" class="text100" id="S_SearchOption">
<option value="BZH">标准号</option>
<option value="TDBZH">替代标准号</option>
<option value="BZMC">标准名称</option>
<option value="ZYFL">专业分类</option>
<option value="BZLX">标准类型</option>
</select>
<input name="T_SearchText" type="text" id="T_SearchText" size="20" maxlength="50">
<input name="Search" type="submit" class="button_all" id="Search" value="查询"></TD>
</TR>
</form>
<%dim sendvalue
if request("search")="查询" then
SearchText = trim(request("T_SearchText"))
SqlSearchText = replace(SearchText,"'","''")
SqlSearchText = replace(SqlSearchText,"[","[[]")
SqlSearchText = replace(SqlSearchText,"]","[]]")
SqlSearchText = replace(SqlSearchText,"%","[%]")
SqlSearchText = replace(SqlSearchText,"_","[_]")
'读取数据库数据
SqlKeyChr = Array("BZH","TDBZH","BZMC","ZYFL","BZLX")
Dim Sqlstr
Sqlstr = "select * from jbright_sort"
sendvalue=trim(request("S_SearchOption"))
if SearchText <> "" then
Sqlstr = Sqlstr & " Where " & SqlKeyChr(SearchOption) & " Like " & " '%"&SqlSearchText&"%' "
end if
else
sqlstr="select sort_id,BZH,TDBZH,BZMC,ZYFL,BZLX,PDFMM from jbright_sort order by sort_id asc"
sendvalue=""
end if
%>
<!--查询响应函数-->
<SCRIPT FOR="SearchButton" EVENT="onClick" LANGUAGE="VBScript">
Dim TheForm
Set TheForm = Document.forms("ReNew")
TheForm.SelPage.value = 1
TheForm.submit()
</SCRIPT>
<SCRIPT FOR="NewView" EVENT="onClick" LANGUAGE="VBScript">
Dim TheForm
Set TheForm = Document.forms("ReNew")
TheForm.SelPage.value = 1
TheForm.submit()
</SCRIPT>
<!--查询响应函数-->
<%
set rs=server.createobject("adodb.recordset")
sql="select * from jbright_sort"
rs.open sql,conn,1,1
%>
<br>
<table border="0" width="100%" cellspacing="1" cellpadding="0" bgcolor="#000000">
<tr>
<td align="center" bgcolor="#336699" height="25"><font color="#FFFFFF">标准号</font></td>
<td align="center" bgcolor="#336699" height="25"><font color="#FFFFFF">标准名称</font></td>
<td align="center" bgcolor="#336699" height="25"><font color="#FFFFFF">操作1</font></td>
<td align="center" bgcolor="#336699" height="25"><font color="#FFFFFF">操作2</font></td>
</tr>
<%
set rs=Server.CreateObject("ADODB.recordset")
rs.open sqlstr,conn,3,2
'分页备用
If Request("Page") = "" Then
intPage = 1
Else
intPage = Clng(Request("Page"))
End If
rs.PageSize = 20
If intPage > rs.PageCount Then
intPage = Rs.PageCount
End If
If intPage <= 0 Then
intPage = 1
End If
If Not Rs.EOF Then
Rs.AbsolutePage = intPage
End If
counts=rs.recordcount
if (counts mod (rs.PageSize))=0 then
k= counts \ rs.PageSize
else
k= counts \ rs.PageSize + 1
end if
n=0
do while not rs.eof and n<rs.PageSize
%>
<td align="center" bgcolor="#FFFFFF" height="25"><a href="look.asp?sort_id=<%=rs("sort_id")%>" target="_blank"><%=rs("BZH")%></a></td>
<td align="center" bgcolor="#FFFFFF" height="25"><a href="../files/<%=rs("pdfmm")%>" target="_blank"><%if len(rs("BZMC"))>20 then BZMC=left(rs("BZMC"),20)&"..." else BZMC=rs("BZMC") end if %><%=BZMC%></a></td>
<td align="center" bgcolor="#FFFFFF" height="25">
<a href='javascript:if(confirm("确实要删除吗?")) location="index.asp?action=del_sort&sort_id=<%=rs("sort_id")%>&<%=rs("sort_id")%>"'>删除</a></td>
<td align="center" bgcolor="#FFFFFF" height="25">
<a href='javascript:location="index.asp?action=modify&sort_id=<%=rs("sort_id")%>&<%=request("sort_id")%>"'>修改</a></td>
<!--
//如果是调用 这样写
<a href="#" onclick=confirmDel(<%=rs("sort_id")%>)>删除</a>
-->
</tr>
<%
rs.movenext
n=n+1
loop
%>
</table>
<tr>
<td align="right" height="22" colspan="20" bgcolor="#ffffff">
<br>
<br>
<a href=index.asp?action=sortlist&S_SearchOption=<%=sendvalue%>&SqlSearchText=<%=SqlSearchText%>&page=1>首页</a>
<%
If intPage = 1 Or intPage = 0 Then
Response.Write "前一页"
Else
%>
<a href=index.asp?action=sortlist&S_SearchOption=<%=sendvalue%>&SqlSearchText=<%=SqlSearchText%>&Page=<%=intPage - 1%>>前一页</a>
<%
End If
%>
<%
If intPage = rs.PageCount or rs.PageCount=0 Then
Response.Write "下一页"
Else
%>
<a href=index.asp?action=sortlist&S_SearchOption=<%=sendvalue%>&SqlSearchText=<%=SqlSearchText%>&page=<%=intPage + 1%>>下一页</a>
<%
End If
%>
<a href=index.asp?action=sortlist&S_SearchOption=<%=sendvalue%>&SqlSearchText=<%=SqlSearchText%>&page=<%=cstr(k)%>>尾页</a>
转向
<select name="selectpage" onChange="MM_goToURL('parent',this.value);return document.MM_returnValue">
<%
If rs.PageCount <= 0 Then
Response.Write "<option value=''>无</option>"
Else
For row = 1 To rs.PageCount
If intPage = row Then
Response.Write "<option value='index.asp?action=sortlist&"&sendvalue&""&SqlSearchText&"page="&row& "' selected>" & row & "</option>"
Else
Response.Write "<option value='index.asp?action=sortlist&"&sendvalue&""&SqlSearchText&"page="&row& "'>" & row & "</option>"
End If
Next
End If
%>
</select>页 共有 <font color=red><%=rs.RecordCount%></font> 条记录
</td>
</tr>
<%
rs.close
set rs=nothing
页:
[1]