查看: 1233|回复: 4

[求代码] acc转sql数据后,网站搜索失效了

[复制链接]
套路王子 发表于 2019-6-27 17:28:07 | 显示全部楼层 |阅读模式
用ACC数据库搜索正常,换成sqlserver2008后搜不到了


<!--#include file="sd_conn.asp"-->
<!--#include file="sd_myfunction.asp"-->
<!--#include file="sd_site.asp"-->
<%
order=request("order")
key=request("key")
key=Server.Htmlencode(key)
xianlu=request("xianlu")
%>
<!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">
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title>搜索<%=key%>的结果_<%=sd_hostname%></title>
<meta name="description" content="<%=sd_description%>">
<meta name="keywords" content="<%=key%>">
<link rel="shortcut icon" href="/images/favicon.ico"/>
<link href="/sd_style.css" type=text/css rel=stylesheet>
<script type="text/javascript" src="/js/key.js"></script>
<META content="MSHTML 6.00.2800.1613" name=GENERATOR>
</head>
<BODY>
<div id="container" class="wrapper">
<!--#include file="sd_sotop.asp"-->
<SCRIPT>function goUrl(url){window.location.href=url;}</SCRIPT>
  <div id="main">
    <div class="left2">
      <div class="sidebar2">
        <div class="title">
          <h3><a href="/" title="<%=sd_hostname%>"><%=sd_hostname%></a> > 搜索<%=key%>的结果</h3>
          <span>所在省份:<select name="diqu" onChange="goUrl(this.options[this.selectedIndex].value)">
            <option value="">请选择</option>
<%
set rs=server.createobject("adodb.recordset")
rs.open "select id,sd_title from sd_yys order by sd_topid desc",conn,1,3
while not rs.eof
response.write "<option value='/diqu/"&rs("id")&"-0.html' >"&rs("sd_title")&"</option>"&vbCrLf
call listunder(1)
rs.movenext
wend
%>
          </select>
          </span>
           </div>
        <div class="content">
          <div id="type"><span class="w_lx">类型</span><span class="w_sj">商家</span><span class="w_cs">&nbsp;</span><span class="w_zpf">总评分</span><span class="w_szd">所在地</span><span class="w_pls">评论/人气</span></div>
          <div id="idclist">
<%
if order="1" then
sql="select * from sd_show where sd_xianlu like '%"&xianlu&"%' and (InStr(1,LCase(sd_name),LCase('"&key&"'),0)<>0 or InStr(1,LCase(sd_namejx),LCase('"&key&"'),0)<>0) and sd_classid in(1,4,13,26,23) and sd_shenhe=1 order by sd_cn_rz desc, sd_tj_px desc,sd_zp desc,id desc"
elseif order="2" then
sql="select * from sd_show where sd_xianlu like '%"&xianlu&"%' and (InStr(1,LCase(sd_name),LCase('"&key&"'),0)<>0 or InStr(1,LCase(sd_namejx),LCase('"&key&"'),0)<>0) and sd_classid in(3,20,31,7,19) and sd_shenhe=1 order by sd_cn_rz desc, sd_tj_px desc,sd_zp desc,id desc"
elseif order="3" then
sql="select * from sd_show where sd_xianlu like '%"&xianlu&"%' and (InStr(1,LCase(sd_name),LCase('"&key&"'),0)<>0 or InStr(1,LCase(sd_namejx),LCase('"&key&"'),0)<>0) and sd_classid in(9,12,10,32) and sd_shenhe=1 order by sd_cn_rz desc, sd_tj_px desc,sd_zp desc,id desc"
elseif order="4" then
sql="select * from sd_show where sd_xianlu like '%"&xianlu&"%' and (InStr(1,LCase(sd_name),LCase('"&key&"'),0)<>0 or InStr(1,LCase(sd_namejx),LCase('"&key&"'),0)<>0) and sd_classid in(14,16,17,6,27) and sd_shenhe=1 order by sd_cn_rz desc, sd_tj_px desc,sd_zp desc,id desc"
elseif order="5" then
sql="select * from sd_show where sd_xianlu like '%"&xianlu&"%' and (InStr(1,LCase(sd_name),LCase('"&key&"'),0)<>0 or InStr(1,LCase(sd_namejx),LCase('"&key&"'),0)<>0) and sd_classid in(21,18,15) and sd_shenhe=1 order by sd_cn_rz desc, sd_tj_px desc,sd_zp desc,id desc"
elseif order="6" then
sql="select * from sd_show where sd_xianlu like '%"&xianlu&"%' and (InStr(1,LCase(sd_name),LCase('"&key&"'),0)<>0 or InStr(1,LCase(sd_namejx),LCase('"&key&"'),0)<>0) and sd_classid in(24,22,25,8,29) and sd_shenhe=1 order by sd_cn_rz desc, sd_tj_px desc,sd_zp desc,id desc"
elseif order="7" then
sql="select * from sd_show where sd_xianlu like '%"&xianlu&"%' and (InStr(1,LCase(sd_name),LCase('"&key&"'),0)<>0 or InStr(1,LCase(sd_namejx),LCase('"&key&"'),0)<>0) and sd_classid in(5,11,33,30,28) and sd_shenhe=1 order by sd_cn_rz desc, sd_tj_px desc,sd_zp desc,id desc"
else
sql="select * from sd_show where sd_xianlu like '%"&xianlu&"%' and (InStr(1,LCase(sd_name),LCase('"&key&"'),0)<>0 or InStr(1,LCase(sd_namejx),LCase('"&key&"'),0)<>0) and sd_shenhe=1 order by sd_cn_rz desc, sd_tj_px desc,sd_zp desc,id desc"
end if

set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if rs.EOF and rs.BOF then
response.write ("<UL><LI style='PADDING-RIGHT: 20px; PADDING-LEFT: 20px; FONT-SIZE: 16px; PADDING-BOTTOM: 20px; PADDING-TOP: 20px'><P>没有您要查找的公司<STRONG></STRONG>?<A style='COLOR: #ff0000' href='/add.html' target='_blank'>点击这里添加</A></P><P style='FONT-SIZE: 12px; PADDING-TOP: 15px'><A href='/'>请尝试换个条件搜索看看,<SPAN style='COLOR: #0099cc'>点此返回首页</SPAN>!</A></P></LI></UL>")
else

myPagesize=50
myPages rs,myPagesize

line=myPagesize
i=0                                 
do while not rs.eof and line>0
i=i+1
%>
            <ul>
              <li class="w_lx"><a href="/" title="等级解释" target="_blank"><%if rs("sd_cn_rz")=3 then%><img src="/images/level_yellow.gif" border="0" title="品牌认证"><%end if%><%if rs("sd_cn_rz")=2 then%><img src="/images/level_blue.gif" border="0" title="品牌认证"><%end if%><%if rs("sd_cn_rz")=1 then%><img src="/images/level_grey.gif" border="0" title="实名认证"><%end if%><%if rs("sd_cn_rz")=0 then%><img src="/images/level_normal.gif" border="0" title="未认证"><%end if%></a></li>
              <li class="w_sj"><h4><a href="/idc/<%=rs("id")%>.html" target="_blank" title="<%=rs("sd_name")%>"><%=rs("sd_namejx")%></FONT></a></h4><br><div class="info">
速度<% if rs("sd_sd")<>0 then
sd1=formatnumber((rs("sd_sd")),0)
call sd(sd1)
else
response.write "<font color=#1941A5><strong>未评</strong></font>"
end if %>,性价比<% if rs("sd_xj")<>0 then
xj1=formatnumber((rs("sd_xj")),0)
call xj(xj1)
else
response.write "<font color=#1941A5><strong>未评</strong></font>"
end if %>,服务<% if rs("sd_fw")<>0 then
fw1=formatnumber((rs("sd_fw")),0)
call fw(fw1)
else
response.write "<font color=#1941A5><strong>未评</strong></font>"
end if %>,安全性<% if rs("sd_aq")<>0 then
aq1=formatnumber((rs("sd_aq")),0)
call aq(aq1)
else
response.write "<font color=#1941A5><strong>未评</strong></font>"
end if %>,推荐指数<span class="s4"><%=rs("sd_zp")*20%>%</span></div></li>
              <li class="w_cs">&nbsp;</li>
              <li class="w_zpf"><div id="scorepic<%=left(rs("sd_zp"),1)%>" title="<%=left(rs("sd_zp"),1)%>星">&nbsp;</div></li>
              <li class="w_szd">
<%
set rre=server.createobject("adodb.recordset")
rre.open "select * from sd_yys where id="&rs("sd_classid"),conn,1,3
response.write ""&rre("sd_title")&""
set rre=nothing
%><%=rs("sd_dishi")%></li>
              <li class="w_pls"><%=rs("sd_pinglun")%>/<%=rs("sd_hits")%></li>
              <li class="wypj">
<%set rs1=server.createobject("adodb.recordset")
sql1="select * from sd_pinglun where sd_show_id="&rs("id")&" order by id desc"
rs1.open sql1,conn,1,1
if rs1.eof then
sd_content="暂时没有对"&rs("sd_namejx")&"的评价"
sd_name="-"
else
sd_content=left(rs1("sd_content"),35)
sd_name=rs1("sd_name")
end if
rs1=close
set rs1=nothing
%>
<strong><%=sd_name%>:</strong><A href="/idc/<%=rs("id")%>.html" title="<%=sd_content%>"><%=sd_content%></A></li>
</ul>
<%rs.movenext
line=line-1
loop
end if%>
ttasp 发表于 2019-6-27 22:10:19 来自手机 | 显示全部楼层
转换后 相应字段要重新设置 比如 ID  时间字段等
 楼主| 套路王子 发表于 2019-6-28 09:39:40 | 显示全部楼层
ttasp 发表于 2019-6-27 22:10
转换后 相应字段要重新设置 比如 ID  时间字段等

重新设置过了,除了网站搜索失效和后台会员管理显示不全,其他功能都是正常的
xuanxiao 发表于 2019-6-28 09:59:09 | 显示全部楼层
套路王子 发表于 2019-6-28 09:39
重新设置过了,除了网站搜索失效和后台会员管理显示不全,其他功能都是正常的

把代码打包发邮箱看看。support@ttasp.COM
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表

在线客服

售前咨询
售后咨询
服务热线
023-58418553
微信公众号