哪位大哥给我看看这段代码,有什么不对的地方,搜索为空时正常,不为空时出现:Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e21'
ODBC 驱动程序不支持所需的属性。
/search.asp,行 253
rs.open sql,conn,1,1
253行在这里
if rs.eof then response.write "暂无信息"
以前数据库信息不多没有这个问题,现在就不行了
-------------------------------------------------------------------
<!--#include file="top_index.asp"-->
<!--#include file="cls_splitpage.asp"-->
<!--#include file="FormatMyDate.Asp"-->
<!--#include file="CutStr.asp"-->
<%
function HTMLEncode(fString)
if not isnull(fString) then
fString = replace(fString, ">", ">")
fString = replace(fString, "<", "<")
fString = Replace(fString, CHR(32), " ")
fString = Replace(fString, CHR(9), " ")
fString = Replace(fString, CHR(34), """)
fString = Replace(fString, CHR(39), "'")
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), "</P><P> ")
fString = Replace(fString, CHR(10), "<BR> ")
dim re
Set re=new RegExp
re.IgnoreCase =True
re.Global=True
re.Pattern = "^(http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
fString = re.Replace(fString,"<a target=_blank href=$1>$1</a>")
re.Pattern = "(http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$"
fString = re.Replace(fString,"<a target=_blank href=$1>$1</a>")
re.Pattern = "([^>='])(http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
fString = re.Replace(fString,"$1<a target=_blank href=$2>$2</a>")
set re=Nothing
HTMLEncode = fString
end if
end function
Function lxname(lx_id,lx_name)
if lx_id<>"" then
w=Len(lx_id)
d=Len(lx_name)
h=InStr(lx_name,"'"&lx_id&"'")
var_lx=Right(lx_name,d-(h+w+2))
d1=InStr(var_lx,",")
lxname=Left(var_lx,d1-1)
else
lxname=""
end if
End Function
%>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
</tr>
</table>
<table border="0" width="760" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" align="center">
<tr>
<td width="200" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table border="0" width="100%" cellspacing="1" cellpadding="0" bgcolor="#DDDDDD">
<tr>
<td align="center" bgcolor="#FFFFFF"><table border="0" width="100%" cellspacing="0" cellpadding="5">
<tr>
<td height="33" background="images/b1t.jpg" align="center" class="Font_12_b">大类目录</td>
</tr>
<%
function xinxi_Count(id)
set rs=Server.CreateObject("ADODB.Recordset")
SQL = "SELECT id FROM [article] WHERE class ="&id&" and city="&city_id
rs.open sql,conn,1,1
xinxi_Count=INT(Rs.recordcount)
rs.close
set rs=nothing
end function
set rs1=Server.CreateObject("ADODB.Recordset")
sql1="select * from [class] where ifshow=true order by pnum"
rs1.open sql1,conn,1,1
do while not rs1.eof
%>
<tr>
<td height="25">
<img src=images/Left_Jt_H.gif align="absmiddle"> <a href="class.asp?city=<%=city_id%>&class=<%=RS1("id")%>"><%=rs1("class")%></a>
<%
rs1.movenext
if not rs1.eof then
response.write "</td></tr>"
else
response.write "</td></tr>"
end if
loop
rs1.close
set rs1=nothing
%>
</table></td>
</tr>
</TABLE></td>
</tr>
<tr>
<td height="5"></td>
</tr>
<tr>
<td><script type="text/javascript"><!--
google_ad_client = "pub-1166438123345321";
google_ad_width = 200;
google_ad_height = 200;
google_ad_format = "200x200_as";
google_ad_type = "image";
google_ad_channel = "";
//-->
</script>
<script type="text/javascript"
src="http://pagead2.
</script>
</td>
</tr>
<tr>
<td height="3"></td>
</tr>
</table></td>
<td align="right" valign="top"><table width="550" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#DDDDDD">
<tr>
<td bgcolor="#FFFFFF"><table width="550" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="5%" valign="baseline" class="Font_14_b"> </td>
<td width="57%" valign="baseline" class="Font_14_b"><img src="images/homehomeh1.gif" width="29" height="36" align="absmiddle">查看您所搜索的结果</td>
<td width="38%" align="right"><table width="99" height="29" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" background="images/home_r_bg5.gif"><img src="images/home_i_b.gif" width="19" height="17" align="absmiddle">
<%if session("userid")="" then%>
<a href="/pub.asp?city=<%=city_id%>" class="font_14_H_28">免费发布</a>
<%else%>
<a href="/user_pub.asp?city=<%=city_id%>" class="font_14_H_28">免费发布</a>
<%end if%> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellpadding="10" cellspacing="1" bgcolor="#D7D7D7">
<tr>
<td valign="top" bgcolor="#FFFFFF">地区分类:<%
set rs=Server.CreateObject("ADODB.Recordset")
sql="select top 15 * from [area] where ifshow=true and city="&abs(city_id)&" order by pnum"
rs.open sql,conn,1,1
if not rs.eof then
ii=1
do while not rs.eof
i=0
response.write ""&vbcrlf
do while i<3 and not rs.eof
if ii<15 then
response.write "<a href=search.asp?city="&city_id&"&keyword="& replace(request("keyword"),"'","") &"&class="&request("class")&"&area="&rs("id")&" class=Font_12_O>"&rs("area")&"</a>"&vbcrlf
else
response.write "<a href=area.asp?city="&city_id&"&type=area class=Font_12_O>其他县区</a>"&vbcrlf
end if
rs.movenext
i=i+1
ii=ii+1
loop
response.write ""&vbcrlf
loop
rs.close
set rs=nothing
else
response.write "暂无分区"
end if
%></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<td><table width="550" border="0" cellpadding="0" cellspacing="1" bgcolor="#DDDDDD">
<tr>
<td bgcolor="#FFFFFF"><table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" align="center">
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td valign="top">
<table border="0" width="550" cellspacing="0" cellpadding="5">
<tr>
<td background="images/b1t.jpg" height="33" style="color:red">搜索结果:</td>
</tr>
<tr>
<td height="33" style="color:red">
<table border="0" width="530" align="center" cellspacing="0" cellpadding="0">
<tr bgcolor="#F7F7F7" height="28">
<td width="310">类型 信息标题</td>
<td width="100">发布人</td>
<td width="120" align="right">发布日期</td>
</tr>
</table>
</td>
</tr>
</table>
<%
Function cname(c_id,c_name)
w=Len(c_id)
d=Len(c_name)
h=InStr(c_name,"'"&c_id&"'")
var_c=Right(c_name,d-(h+w+2))
d1=InStr(var_c,",")
cname=Left(var_c,d1-1)
End Function
Function lxname(lx_id,lx_name)
w=Len(lx_id)
d=Len(lx_name)
h=InStr(lx_name,"'"&lx_id&"'")
var_lx=Right(lx_name,d-(h+w+2))
d1=InStr(var_lx,",")
lxname=Left(var_lx,d1-1)
End Function
set rs3=Server.CreateObject("ADODB.Recordset")
sql3="select * from c"
rs3.open sql3,conn,3,3
mypx=rs3("px")
set rs=Server.CreateObject("ADODB.Recordset")
sql="select * from article where stoptime>#"&date()&"# and ifpi=true"
if request("class")<>"" and request("class")<>"全部分类" then
sql=sql&" and class="&abs(request("class"))
end if
if request("area")<>"" and request("area")<>"全部地区" then
sql=sql&" and area="&abs(request("area"))
end if
if request("keyword")<>"" then
sql=sql&" and (user like '%" & replace(request("keyword"),"'","") & "%' or body like '%" & replace(request("keyword"),"'","") & "%' or url like '%" & replace(request("keyword"),"'","") & "%' or qq like '%" & replace(request("keyword"),"'","") & "%' or title like '%" & replace(request("keyword"),"'","") & "%')"
end if
sql=sql& " order by toptype desc,"
if rs3("ifpnum")=true then
sql=sql&" pnum desc,"
end if
sql=sql&" "&mypx&" desc"
rs3.close
set rs3=nothing
rs.open sql,conn,1,1
if rs.eof then response.write "暂无信息"
Dim Page, I
Set Page = New Cls_SplitPage
With Page
.Con = COnn
.Sql = Sql
.PageSize = 20 ' @ 修改分页条数
End With
Set Rs = Page.Rs
For I = 1 To Page.PageSize
If Rs.Eof Then Exit For
set rs1=Server.CreateObject("ADODB.Recordset")
sql1="select * from [user] where id="&rs("userid")&""
rs1.open sql1,conn,1,1
if not rs1.eof then
temuser="<div title=浏览此会员发布的所有信息><font color=#000080><u>"&rs1("username")&"</u></font></div>"
temuser2=""&rs1("id")&""
else
temuser="游客"
temuser2="0"
end if
rs1.close
set rs1=nothing
%>
<table border="0" width="530" align="center"cellspacing="0" cellpadding="0">
<tr onMouseOver="this.bgColor='#F7F7F7';" onMouseOut="this.bgColor='#FFFFFF';">
<td width="310" height="26"><%if rs("leixing")<>"" then%><%=lxname(rs("leixing"),leixing)%><%end if%> <a <%if rs("htmlurl")<>"" then %>href='/html/<%=xxsc_Path&rs("htmlurl")%>'<%else%>href=read.asp?id=<%=rs("id")%><%end if%> title=<%=rs("title")%> target=_blank>
<%if rs("color")<>"默认" then response.write "<font color="&rs("color")&">"%>
<%if rs("xie")=true then response.write "<i>"%>
<%if rs("xia")=true then response.write "<u>"%>
<%=rs("title")%>
<%if rs("color")<>"默认" then response.write "</font>"%>
<%if rs("xie")=true then response.write "</i>"%>
<%if rs("xia")=true then response.write "</u>"%></a>
<%if rs("toptype")>0 then response.write "<font color=red><b>顶</b></font>"%>
</td>
<td width="100"><%if temuser2=0 then%><%=temuser%><%else%><a href="u_class.asp?city=<%=city_id%>&userid=<%=temuser2%>"><%=temuser%></a><%end if%> </td>
<td align="right" width="120"><%=FormatMyDate(rs("addtime"),"{Y}-{m}-{d} {h}:{mi}:{s}")%></td>
</tr>
<tr>
<td height="1" colspan="3" background="images/Class_X.gif"></td>
</tr>
</table> </td>
</tr>
<tr>
<td>
<table width="530" border="0" cellspacing="0" cellpadding="0" align="center"></tr>
<% Rs.MoveNext:Next %>
<tr>
<tr>
<td height="5" colspan="3" ></td>
</tr>
<td colspan="3">
<%= Page.ShowPage %></td>
</tr>
<tr>
<td colspan="3">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<script type="text/javascript"><!--
google_ad_client = "pub-1166438123345321";
google_ad_width = 468;
google_ad_height = 15;
google_ad_format = "468x15_0ads_al_s";
google_ad_channel = "";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "000099";
google_color_text = "000000";
google_color_url = "008000";
//-->
</script>
<script type="text/javascript"
src="http://pagead2.
</script>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="5" colspan="3" ></td>
</tr>
<% Rs.Close:Set Rs = Nothing %>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<!--#include file="bottom.asp"-->