| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 403 人关注过本帖
标题:[求助]求助修改asp的一段代码
只看楼主 加入收藏
cccoo1
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-6-11
收藏
 问题点数:0 回复次数:2 
[求助]求助修改asp的一段代码

这是一个人才网站的搜索代码,但是现在搜索的最新发布的信息老是排在倒数第四的位置,如何修改,该修改哪里.请教.

搜索文件代码如下:

<%ds="../"%>
<!--#include file="../inc/sub.asp" -->
<!--#include file="../conn/conn.asp" -->
<!--#include file="../inc/memberpagelist.asp" -->
<!--#include file="../inc/replace.asp" -->
<html>
<head>
<title>职位搜索结果-<%=SiteName%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../css/css.css" rel=stylesheet>
</head>
<body>
<!--#include file="../inc/head.asp"-->
<br class="br">
<table width="956" height="30" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="7"></td>
</tr>
<tr>
<td height="40" background="images/top_bg.gif"><img src="images/top_zw.gif" width="278" height="39"></td>
</tr>
</table>
<TABLE width=956 border=0 align="center" cellPadding=5 cellSpacing=0>
<TBODY>
<TR align=middle bgColor=#99C1EE>
<TD width=60 height="30" bgcolor="#99C1EE"><strong><font color="#FFFFFF">编号</font></strong></TD>
<TD width=180 bgcolor="#99C1EE"><strong><font color="#FFFFFF">职位名称</font></strong></TD>
<TD width=240 bgcolor="#99C1EE"><strong><font color="#FFFFFF">公司名称</font></strong></TD>
<TD bgcolor="#99C1EE"><strong><font color="#FFFFFF">工作地区</font></strong></TD>
<TD width=75><strong><font color="#FFFFFF">月薪</font></strong></TD>
<TD width=100><strong><font color="#FFFFFF">发布日期</font></strong></TD>
</TR>
<%
sql="select * from job_c_hire where hire_status=1 and cdate(hire_enddate)>=date()"
keyword=CheckStr(trim(request("keyword")))
if keyword="输入公司/职位关键词" then
keyword=""
end if
if trim(request("keywordtype"))<>"" then
keywordtype=cint(trim(request("keywordtype")))
select case keywordtype
case 1
sql=sql&" and hire_place like ''%"&keyword&"%''"
case 2
sql=sql&" and hire_comname like ''%"&keyword&"%''"
case else
sql=sql&" and (hire_place like ''%"&keyword&"%'' or hire_comname like ''%"&keyword&"%'')"
end select
end if

hire_trade=CheckStr(trim(request("trade")))
if hire_trade<>"" and hire_trade<>"0000" then
mystring=split(hire_trade,",")
for i=0 to ubound(mystring)
if i=0 then
sql=sql&" and (hire_trade like ''%"&trim(mystring(i))&"%''"
else
sql=sql&" or hire_trade like ''%"&trim(mystring(i))&"%''"
end if
next
sql=sql&")"
end if
if request("positionone")<>"" then
hire_position=request("positionone")
elseif request("positiontwo")<>"" then
hire_position=hire_position&","&request("positiontwo")
end if
if hire_position<>"" then
mystring=split(hire_position,",")
for i=0 to ubound(mystring)
if i=0 then
sql=sql&" and (hire_position like ''%"&trim(mystring(i))&"%''"
else
sql=sql&" or (hire_position like ''%"&trim(mystring(i))&"%''"
end if
next
sql=sql&")"
end if

if request("workaddone")<>"" then
hire_workadd=request("workaddone")
elseif request("workaddtwo")<>"" then
hire_workadd=hire_workadd&","&request("workaddtwo")
end if
if hire_workadd<>"" then
mystring=split(hire_workadd,",")
for i=0 to ubound(mystring)
if i=0 then
sql=sql&" and (hire_workadd like ''%"&trim(mystring(i))&"%''"
else
sql=sql&" or hire_workadd like ''%"&trim(mystring(i))&"%''"
end if
next
sql=sql&")"
end if
pgsz=20
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
If not rs.eof then
rs.pagesize=pgsz
if request("currentpage")="" then
ipage=1
else
if cint(request("currentpage"))>rs.pagecount then
ipage=rs.pagecount
else
ipage=cint(request("currentpage"))
end if
end if
rs.absolutepage=ipage
for j=1 to rs.pagesize
recno=(ipage-1)*rs.pagesize+j
%>
<TR bgColor=#ffffff>
<TD height="25" align=middle bgcolor="#EFF6FF"><%=recno%></TD>
<TD bgcolor="#f9f9f9"><a href="../company/hire_info.asp?id=<%=rs("hire_id")%>" target="_blank"><FONT color=#0000cc><%=rs("hire_place")%></FONT></a></TD>
<TD bgcolor="#EFF6FF"><A href="../company/company_info.asp?id=<%=rs("company_id")%>" target="_blank"><FONT color=#0000cc><%=rs("hire_comname")%></FONT></A></TD>
<TD bgcolor="#f9f9f9"><FONT color=#000080>
<%
set rst=server.createobject("adodb.recordset")
workadds=rs("hire_workadd")
if workadds<>"" and not isnull(workadds) then
if workadds="0000" then
response.write "<OPTION value=''0000''>不限</option>"
else
wstring=split(workadds,",")
for i=0 to ubound(wstring)
province_name=""
capital_name=""
city_name=""
workadd=trim(wstring(i))
if workadd<>"" then
mystring=split(workadd,"*")
length=ubound(mystring)
select case length
case "0"
province=trim(mystring(0))
sql="select province_city from job_provinceandcity where id="&province&""
rst.open sql,conn,1,1
if not rst.eof then
province_name=rst("province_city")
end if
rst.close
if province_name<>"" then
response.write province_name&" "
end if
case "1"
province=trim(mystring(0))
capital=trim(mystring(1))
sql="select province_city from job_provinceandcity where id="&province&""
rst.open sql,conn,1,1
if not rst.eof then
province_name=rst("province_city")
end if
rst.close
sql="select province_city from job_provinceandcity where id="&capital&""
rst.open sql,conn,1,1
if not rst.eof then
capital_name=rst("province_city")
end if
rst.close
if province_name<>"" and capital_name<>"" then
response.write province_name&capital_name&" "
end if
case "2"
province=trim(mystring(0))
capital=trim(mystring(1))
city=trim(mystring(2))
sql="select province_city from job_provinceandcity where id="&province&""
rst.open sql,conn,1,1
if not rst.eof then
province_name=rst("province_city")
end if
rst.close
sql="select province_city from job_provinceandcity where id="&capital&""
rst.open sql,conn,1,1
if not rst.eof then
capital_name=rst("province_city")
end if
rst.close
sql="select province_city from job_provinceandcity where id="&city&""
rst.open sql,conn,1,1
if not rst.eof then
city_name=rst("province_city")
end if
rst.close
if province_name<>"" and capital_name<>"" and city_name<>"" then
response.write province_name&capital_name&city_name&" "
end if
end select
end if
next
end if
end if
set rst=nothing
%>
</FONT></TD>
<TD align=middle bgcolor="#EFF6FF">
<%
if rs("hire_pay")<>"" and not isnull(rs("hire_pay")) then
if rs("hire_pay")=0 then
response.write "面议"
else
response.write rs("hire_pay")
end if
end if
%>
</TD>
<TD align=middle bgcolor="#f9f9f9"><%=year(rs("hire_announcedate"))&"-"&month(rs("hire_announcedate"))&"-"&day(rs("hire_announcedate"))%></TD>
</TR>
<%
rs.movenext
if rs.eof then
exit for
end if
next
%>
<TR bgcolor="#f9f9f9">
<TD colspan="6" align=middle>
<%call pagelist("hire_searchresult.asp","keyword="&keyword&"&keywordtype="&keywordtype&"&trade="&hire_trade&"&position="&hire_position&"&workadd="&hire_workadd&"",rs.pagecount,ipage,rs.recordcount)%>
</TD>
</TR>
<%
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
</TBODY>
</TABLE>
<table width="956" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="10"></td>
</tr>
</table>
<!--#include file="../inc/bottom.asp"-->
</div>
</body>
</html>

[此贴子已经被作者于2007-6-12 12:00:55编辑过]

2007-06-12 10:43
lovemole
Rank: 1
等 级:新手上路
帖 子:58
专家分:7
注 册:2007-6-1
收藏
得分:0 
把每个sql=sql&")"
替换成sql=sql&") order by time DESC"
其中time是信息表里的时间字段

2007-06-12 11:37
cccoo1
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-6-11
收藏
得分:0 
谢谢替换了,可是又有问题,最新发布的信息老是排在倒数第四的位置,每发布一个新的信息,搜索都是排在倒数第四,这如何改呢
2007-06-12 11:48
快速回复:[求助]求助修改asp的一段代码
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022034 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved