分页显示直接跳转问题,谁帮我看看啊,谢谢
分页显示中,如果没有查询条件限制就能够实现正确跳转,但是有查询条件时第一页显示的结果是正确的,但是直接跳转后就转到所有记录的第几页。不知道问题出在哪,大家帮帮忙,谢谢!<!--#include file="Conn.asp" -->
<%
Dim Sql,i,CurrentPage,FileName
Dim TodayDate,strDate,strIsLockId,tdcss
Dim strSelComId
Set Rs = server.CreateObject("ADODB.recordset")
set rs1=server.CreateObject("adodb.recordset")
Dim Position_b,Position_s,Qualification,Province,City,County,ValidityDate,keyword
If request.Form<>"" then
Response.Redirect("Company_Index.asp?Position_b="& Request.Form("Position_b") & "&Position_s=" & Request.Form("Position_s") & "&Qualification=" & Request.Form("Qualification") & "&Province=" & Request.Form("Province") & "&City=" & Request.Form("City") & "&County=" & Request.Form("County") & "&ValidityDate=" & Request.Form("ValidityDate") & "&keyword=" & Request.Form("keyword"))
end if
Position_b = Trim(Request.QueryString("Position_b"))
Position_s = Trim(Request.QueryString("Position_s"))
Qualification = Trim(Request.QueryString("Qualification"))
Province = Trim(Request.QueryString("Province"))
City = Trim(Request.QueryString("City"))
County = Trim(Request.QueryString("County"))
ValidityDate = Trim(Request.QueryString("ValidityDate"))
keyword = Trim(Request.QueryString("keyword"))
TodayDate =Date()
'FileName=request.QueryString("FileName")
If Position_b <> "" Then
Sql = Sql & " and Position_b = '"& Position_b &"' "
End If
If Position_s <> "" And Position_s <> "不限" Then
Sql = Sql & " and (Position_s = '"& Position_s &"' or Position_s = '不限') "
End If
If Qualification <> "" And Qualification <> "不限" Then
Sql = Sql & " and Qualification = '"& Qualification &"' "
End If
If Province <> "" Then
Sql = Sql & " and Province = '"& Province &"' "
End If
If City <> "" Then
Sql = Sql & " and City = '"& City &"' "
End If
If County <> "" And County <> "不限" Then
Sql = Sql & " and (County = '"& County &"' or County = '不限') "
End If
'response.Write(ValidityDate)
If ValidityDate<>"" Then
sqltext="select *from RecruitTb1 "
set rs1=conn.execute(sqltext)
today=now()
'thatday=dateadd("d",-cint(ValidityDate),today)
'response.Write(thatday&"<br>")
'response.Write(today)
RecruitId="0"
do while not rs1.eof
days1=rs1("EditDate")
'response.Write(days1)
days=DateDiff("d",days1,today)
'response.Write(days&"<br>")
If days<cint(ValidityDate) Then
'response.Write(rs1("editdate")&","&Rs1("RecruitId")&"<br>")
RecruitId=RecruitId&","&rs1("RecruitId")
End If
rs1.movenext
Loop
rs1.close
'response.Write(days)
sql=sql&"and RecruitId in ("&RecruitId&")"
End If
If Keyword <> "" And Keyword <> "请输入要查询的关键字" Then
Sql1="select ComId from CompanyTb1 where CompanyName like '%"& Keyword &"%' order by ComId asc"
Set Rs=conn.execute(sql1)
'response.Write(sql)
SelComId="0"
Do While Not Rs.Eof
selComId = selComId & "," & Rs("ComId")
'response.Write(selcomid)
Rs.MoveNext
Loop
Rs.Close
Sql=Sql & " and (JobNam like '%"& keyword &"%' or ComId in ("& SelComId &")) "
'response.Write(sql)
Else
selComId = "0"
End If
Rs.Open "select ComId from CompanyTb1 where IsLock = '1' order by ComId asc" , Conn , 1 , 1
If not Rs.eof then
IsLockId="0"
Do While Not Rs.Eof
IsLockId = IsLockId & "," & Rs("ComId")
Rs.MoveNext
Loop
Sql=Sql& "and ComId not in ("&IsLockId&" )"
End If
Rs.Close
Sql="select * from RecruitTb1 where IsPause='0' "&sql&" order by RecruitId desc"
'response.Write(sql)
FileName = "Company_Index.asp?Position_b="& Position_b & "&Position_s=" & Position_s & "&Qualification=" & Qualification & "&Province=" & Province & "&City=" & City & "&County=" & County & "&ValidityDate=" & ValidityDate & "&keyword=" & keyword
%><TITLE>最新招聘</TITLE>
<script language="javascript" src="Comm/Job_All.js"></script>
<script language="javascript" src="Comm/Job_Function.js"></script>
<script language="javascript" src="Comm/Area_All.js"></script>
<script language="javascript" src="Comm/Area_Function.js"></script>
<script language="javascript">
function GotoPage()
{
var Fn = ListForm.FileName.value;
var Cp = ListForm.CurrentPage.value;
//location.href = Fn + "&page=" + Cp;
location.href= Fn + "&page=" + Cp
}
</script>
<!--#include file="top.asp" -->
<table width="966" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="225" align="center" valign="top">
<table align="left">
<tr width="225"><td><!--#include file="dl.asp" --></td></tr>
<tr width="225"><td><!--#include file="ad.asp" --></td></tr>
</table>
</td>
<td align="right" valign="top"><table width="98%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="5" height="5"><img src="Images/Ind_News_01.jpg" width="5" height="5" /></td>
<td width="638" height="5" background="Images/Ind_News_02.jpg"></td>
<td width="5" height="5"><img src="Images/Ind_News_03.jpg" width="5" height="5" /></td>
</tr>
<tr>
<td width="5" background="Images/Ind_News_08.jpg"></td>
<td width="638" height="27" bgcolor="#F9F9F9"><form id="SearchForm" name="SearchForm" method="post" action="Company_Index.asp" style="margin:0">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="16%" rowspan="2"><img src="Images/Search_t_01.jpg" width="105" height="27" /></td>
<td height="30" colspan="2"><select name="Position_b" class="input_bk_D2D2D2" id="Position_b" style="width:140px;" onChange="SelectChange('Position_s' , document.all.Position_b.options[document.all.Position_b.selectedIndex].value , arrPosition_b , arrPosition_s);">
<option value="">-选择工作职能-</option>
</select>
<select name="Position_s" class="input_bk_D2D2D2" id="Position_s" style="width:150px;">
<option value="">-选择工作职位-</option>
</select>
<select name="Province" id="Province" style="width:60px;" onChange="SelChgCity('City' , document.all.Province.options[document.all.Province.selectedIndex].value , arrProvince , arrCity , 'County');">
<option value="">省份</option>
</select>
<select name="City" id="City" style="width:70px;" onChange="SelChgCounty('County' , document.all.City.options[document.all.City.selectedIndex].value , arrCity , arrCounty);">
<option value="">地级市</option>
</select>
<select name="County" id="County" style="width:60px;">
<option value="">不限</option>
</select> </td>
</tr>
<tr>
<td width="71%" height="30"><select name="Qualification" class="input_bk_D2D2D2" id="Qualification" style="width:87px;">
<option value="">-学历要求-</option>
<%
Rs.Open "select * from QualificationTbl order by QualificationId asc" , Conn , 1 , 1
Do While Not Rs.Eof
Response.Write("<option value="""& Rs("QualificationName") &""" ")
If Rs("QualificationName") = Qualification Then Response.Write(" selected")
Response.Write(">"& Rs("QualificationName") &"</option>" & vbCrLf)
Rs.MoveNext
Loop
Rs.Close
%>
</select>
<select name="ValidityDate" id="ValidityDate" style="width:130px;">
<option value="" <%If ValidityDate = "" Then Response.Write("selected")%>>-选择发布时间-</option>
<option value="1" <%If ValidityDate = "1" Then Response.Write("selected")%>>一天内</option>
<option value="2" <%If ValidityDate = "2" Then Response.Write("selected")%>>两天内</option>
<option value="3" <%If ValidityDate = "3" Then Response.Write("selected")%>>三天内</option>
<option value="7" <%If ValidityDate = "7" Then Response.Write("selected")%>>一周内</option>
<option value="14" <%If ValidityDate = "14" Then Response.Write("selected")%>>两周内</option>
<option value="30" <%If ValidityDate = "30" Then Response.Write("selected")%>>一月内</option>
<option value="60" <%If ValidityDate = "60" Then Response.Write("selected")%>>两月内</option>
<option value="90" <%If ValidityDate = "90" Then Response.Write("selected")%>>三月内</option>
</select>
<input name="keyword" type="text" class="input_bk_D2D2D2" id="keyword" value="<%=keyword%>" size="30" onFocus="javascript:if(this.value=='请输入要查询的关键字')this.value='';" onBlur="javascript:if(this.value=='')this.value='请输入要查询的关键字';" /></td>
<td width="13%"><input type="image" name="imageField" src="Images/Search_t_02.jpg" /></td>
</tr>
</table>
</form> </td>
<td width="5" background="Images/Ind_News_04.jpg"></td>
</tr>
<tr>
<td width="5" height="5"><img src="Images/Ind_News_07.jpg" width="5" height="5" /></td>
<td width="638" height="5" background="Images/Ind_News_06.jpg"></td>
<td width="5" height="5"><img src="Images/Ind_News_05.jpg" width="5" height="5" /></td>
</tr>
</table>
<%
Response.Write("<script language=""javascript"">" & vbCrLf)
Response.Write("InitPosition(""Position_b"" , ""Position_s"" , arrPosition_b , arrPosition_s , """ & Position_b & """ , """ & Position_s & """)" & vbCrLf)
Response.Write("InitArea(""Province"" , ""City"" , ""County"" , arrProvince , arrCity , arrCounty , """ & Province & """ , """ & City & """ , """ & County & """)" & vbCrLf)
Response.Write("</script>" & vbCrLf)
%>
<table width="95%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="5"></td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" width="100%"
border="0">
<tbody>
<tr>
<td width="3"><img height="26"
src="newimg/right20_left.jpg"
width="3" /></td>
<td style="PADDING-LEFT: 5px; PADDING-TOP: 2px"
valign="bottom"
background="newimg/right20_bg.jpg"><table cellspacing="0" cellpadding="0" width="100%"
border="0">
<tbody>
<tr>
<td
style="BORDER-TOP: #fdbd99 1px solid; BORDER-LEFT: #fdbd99 1px solid"
align="middle" width="65" bgcolor="#ffffff"
height="22"><div align="center"><strong><font color="#f16100">最新职位</font></strong></div></td>
<td> </td>
</tr>
</tbody>
</table></td>
<td width="3"><img height="26"
src="newimg/right20_right.jpg"
width="3" /></td>
</tr>
</tbody>
</table>
<form id="ListForm" name="ListForm" method="get" action="" style="margin:0">
<table width="98%" border="0" cellpadding="5" cellspacing="0" class="ntblbk">
<tr>
<td width="179" height="25" align="center" background="images/top_4.gif" class="font12b_black">公司名称</td>
<td align="center" background="images/top_4.gif" class="font12b_black">招聘职位</td>
<td align="center" background="images/top_4.gif" class="font12b_black">学历要求</td>
<td align="center" background="images/top_4.gif" class="font12b_black">月薪</td>
<td align="center" background="images/top_4.gif" class="font12b_black">工作地点</td>
<td align="center" background="images/top_4.gif" class="font12b_black">更新时间</td>
</tr>
<%
response.Write(sql)
rs.open sql,conn,1,3
If Rs.Eof Then
%>
<tr>
<td height="30" colspan="6" align="center" class="td_line_col_FFFFFF">没有找到您想要查询的职位!</td>
</tr>
<%
Else
Rs.PageSize = 2
If request.QueryString("CurrentPage")<>"" Then
CurrentPage=cint(request.QueryString("CurrentPage"))
else
CurrentPage=1
End If
If CurrentPage<=1 Then
CurrentPage=1
End If
Rs.AbsolutePage = CurrentPage
If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount
i=1
Do While Not Rs.Eof and i<=Rs.Pagesize
comid=rs("comid")
Sql1="select *from companytb1 where comid="&comid&""
rs1.open sql1,conn,1,1
Companyname=Rs1("Companyname")
rs1.close
%>
<tr>
<td height="30" ><a href="Company_View.asp?ComId=<%=Rs("ComId")%>" target="_blank" class="lansmall"><%=Companyname%></a></td>
<td width="120" height="30" align="center" ><a href="Company_Job.asp?JobId=<%=Rs("RecruitId")%>" target="_blank" class="lansmall"><%=Rs("JobNam")%></a></td>
<td width="71" height="30" align="center" ><%=Rs("Qualification")%></td>
<td width="61" height="30" align="center" ><%
If Rs("Salary") = 0 Then
Response.Write("面议")
Else
Response.Write(Rs("Salary") & "元/月")
End if
%></td>
<td width="86" height="30" align="center" ><%=Rs("City")%>/<%=Rs("County")%></td>
<td width="71" height="30" align="center" ><%=FormatDateTime(Rs("EditDate") , 2)%></td>
</tr>
<%
Rs.MoveNext
i=i+1
Loop
%>
<tr>
<td height="35" colspan="6" align="right">
<input name="FileName" type="hidden" id="FileName" value="<%=FileName%>" />
共<%=Rs.recordcount%>条记录 共<%=Rs.PageCount%>页
第<%=CurrentPage%>页
<%
If CurrentPage<>1 Then
%><a href="<%=FileName%>&CurrentPage=1">首页</a>
<%else%>
首页
<%end if %>
<%
If CurrentPage<>Rs.PageCount Then
%>
<a href="<%=FileName%>&CurrentPage=<%=CurrentPage-1%>">上一页</a>
<a href="<%=FileName%>&CurrentPage=<%=CurrentPage+1%>">下一页</a>
<%End If
If CurrentPage<>Rs.PageCount Then
%>%>
<a href="<%=FileName%>&CurrentPage=<%=Rs.PageCount%>">尾页</a>
<%else%>
尾页
<%end if %>
跳转到<input name="CurrentPage" type="text" id="CurrentPage" value="<%=CurrentPage%>" size="4" />
页
<input name="GoPage" type="submit" onclick="javascript:GotoPage();" value="跳转" /></td>
</tr>
<%
End If
Rs.Close
%>
</table>
</form> </td>
</tr>
</table>
[[it] 本帖最后由 关小彤 于 2008-12-10 14:41 编辑 [/it]]