我的网站上有个搜索框,一直运行正常,昨天突然就不能用了,一搜索就出现这样的错误提示:
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e21'
ODBC 驱动程序不支持所需的属性。
/Result.asp,行160
这里的Result.asp,行160 代码如下:
rs.Open rs.Source,conn,1,1
请问这是什么原因,怎样修改?
hangxj:
下次不要乱发网站,可能做为广告来处理
对ASP语言我不懂,我的网站程序是现成的程序,不知你要看哪个代码,我把Result.asp的代码全贴出来吧
<%@ Language=VBScript%>
<!--#include file=include/conn.asp -->
<!--#include file=include/config.asp -->
<!--#include file="admin/char.inc"-->
<%
request_BigClassid=checkstr(Request("BigClassid"))
keyword=trim(checkstr(Request("keyword")))
keyword=replace(keyword,"'","")
PageShowSize = 10 '每页显示多少个页
MyPageSize = 20 '每页显示多少条
If Not IsNumeric(Request("page")) Or IsEmpty(Request("page")) Or Request("page") <=0 Then
MyPage=1
Else
MyPage=Int(Abs(Request("page")))
End if
if keyword="" or keyword="关键字" then
%>
<script language=javascript>
history.back()
alert("请输入查询关键字!")
</script>
<body onload=javascript:window.close()></body>
<%
Response.End
end if
if request("action")="" then
findword="title like '%"&keyword&"%' or content like '%"&keyword&"%' or author like '%"&keyword&"%' or editor like '%"&keyword&"%' or about like '%"&keyword&"%'"
elseif request("action")="title" then
findword="title like '%"&keyword&"%' "
elseif request("action")="content" then
findword="content like '%"&keyword&"%' "
elseif request("action")="editor" then
findword="editor like '%"&keyword&"%' or author like '%"&keyword&"%' "
elseif request("action")="about" then
findword="about like '%"&keyword&"%' "
end if
set rs=server.CreateObject("ADODB.RecordSet")
rs.Source="select * from type order by typeorder"
rs.Open rs.Source,conn,1,1 (这里是160行)
dim ArraytypeID(10000),ArraytypeName(10000),Arraytypecontent(10000)
typeCount=rs.RecordCount
for i=1 to typeCount
ArraytypeID(i)=rs("typeID")
ArraytypeName(i)=rs("typeName")
Arraytypecontent(i)=rs("typecontent")
rs.MoveNext
next
rs.Close
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>关键字:<%=keyword%>__搜索__<%=jjgn%></title>
<LINK href=txt.css rel=stylesheet>
</head>
<body topmargin="0" background="img/bg.gif">
<!--#include file=include/top.asp -->
<table width="778" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border-left: 1px solid #cccccc; border-right: 1px solid #cccccc">
<tr valign="top">
<td width="200" bgcolor="#f4f4f4"><table width="94%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="IMAGES/kb.gif" width="1" height="8"></td>
</tr>
<tr>
<td valign="top">
<table width="90%" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" id="AutoNumber4" style="border: 1px solid #cccccc">
<tr>
<td width="100%" align=center><img src="img/type_left_02.gif" width="180" height="29"></td>
</tr>
<tr>
<td align=center><img name="" src="" width="1" height="8" alt=""></td>
</tr>
<tr>
<td align=center><%if search="1" then%>
<!--#include file=search.asp-->
<%else%>
<!--#include file=search1.asp-->
<%end if%></td>
</tr>
<tr>
<td align=center><img name="" src="" width="1" height="8" alt=""></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
<tr>
</tr>
</table></td>
</tr>
</table></td>
<td bgcolor="#CCCCCC"><img name="" src="" width="1" height="1" alt=""></td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#F4F4F4" ><img name="" src="" width="1" height="8" alt=""></td>
</tr>
<tr>
<td height="30" background="img/type_bg.gif" class="6"> <strong><font color="#FF00000">当前位置:</font></strong> <a class="daohang" href="./" >网站首页</a> - 搜索 - 关键字:<%=keyword%></b></td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" id="AutoNumber3" style="border-collapse: collapse">
<tr>
<td></td>
</tr>
<tr>
<td><table border="0" cellpadding="3" cellspacing="0" width="100%">
<%set rs=server.CreateObject("ADODB.RecordSet")
if request_BigClassid<>"" then
if Request.cookies("key")="" then
rs.Source="select * from News where BigClassid=" & request_BigClassid &" and " & findword & " and checkked=1 and newslevel=0 order by NewsID DESC"
end if
if Request.cookies("key")="super" or Request.cookies("key")="typemaster" or Request.cookies("key")="bigmaster" or Request.cookies("key")="smallmaster" or Request.cookies("key")="check" then
rs.Source="select * from News where BigClassid=" & request_BigClassid &" and " & findword & " and checkked=1 order by NewsID DESC"
end if
if Request.cookies("key")="selfreg" then
if Request.cookies("reglevel")=3 then
rs.Source="select * from News where BigClassid=" & request_BigClassid &" and " & findword & " and checkked=1 and newslevel<=3 order by NewsID DESC"
end if
if Request.cookies("reglevel")=2 then
rs.Source="select * from News where BigClassid=" & request_BigClassid &" and " & findword & " and checkked=1 and newslevel<=2 order by NewsID DESC"
end if
if Request.cookies("reglevel")=1 then
rs.Source="select * from News where BigClassid=" & request_BigClassid &" and " & findword & " and checkked=1 and newslevel<=1 order by NewsID DESC"
end if
end if
else
if Request.cookies("key")="" then
rs.Source="select * from News where " & findword & " and checkked=1 and newslevel=0 order by NewsID DESC"
end if
if Request.cookies("key")="super" or Request.cookies("key")="typemaster" or Request.cookies("key")="bigmaster" or Request.cookies("key")="smallmaster" or Request.cookies("key")="check" then
rs.Source="select * from News where " & findword & " and checkked=1 order by NewsID DESC"
end if
if Request.cookies("key")="selfreg" then
if Request.cookies("reglevel")=3 then
rs.Source="select * from News where " & findword & " and checkked=1 and newslevel<=3 order by NewsID DESC"
end if
if Request.cookies("reglevel")=2 then
rs.Source="select * from News where " & findword & " and checkked=1 and newslevel<=2 order by NewsID DESC"
end if
if Request.cookies("reglevel")=1 then
rs.Source="select * from News where " & findword & " and checkked=1 and newslevel<=1 order by NewsID DESC"
end if
end if
end if
rs.Open rs.Source,conn,1,1
rs.PageSize=20
rs.CacheSize = RS.PageSize
for i=1 to rs.PageSize *( page-1)
if not rs.EOF then
rs.MoveNext
end if
next
Response.Write "<tr><td width=100% height=25 align=center > "
if rs.EOF then
Response.Write "<font color=red>抱歉,没有搜索到相关的资料!</font>"
else
rs.PageSize = MyPageSize
MaxPages = rs.PageCount
rs.absolutepage = MyPage
total = rs.RecordCount
Response.Write "共搜索到" & total & "条相关资料,当前第"& myPage &"/"& MaxPages &"页,每页"& rs.PageSize &"条"
end if
Response.Write "</td></tr>"
If Not rs.eof then
i = 0
do until rs.Eof or i = rs.PageSize
if rs("picname")<>"" then
img="<font color=red>[图]</font>"
else
img=""
end if
%>
<tr>
<%
title=trim(rs("title"))
title=replace(title,"<br>","")
dim bigclassid
bigclassid=rs("bigclassid")
set rs11=server.CreateObject("ADODB.RecordSet")
rs11.Source="select * from bigclass where bigclassid="&bigclassid&""
rs11.Open rs11.Source,conn,1,1
typeid=rs11("typeid")
rs11.Close
dim mode
set rs12=server.CreateObject("ADODB.RecordSet")
rs12.Source="select * from type where typeid="&typeid&""
rs12.Open rs12.Source,conn,1,1
mode=rs12("mode")
rs12.Close
%>
<td width="100%" height="25" background="img/line.gif"> · <a class="middle" href="ReadNews.asp?NewsID=<%=rs("NewsID")%>" target=_blank title="<%=title%>">
<%if mode="2" then%>
<%=img%>
<%end if%>
<%if len(title)>30 then%>
<%=left(title,30)%>...
<%else%>
<%=title%>
<%end if%>
</font></a><font class=middle>(<%=rs("UpdateTime")%>)[<font color="#ff0000"><%=rs("click")%></font>]</font></td>
</tr>
<%
rs.MoveNext
i = i + 1
loop
%>
<tr>
<td width="100%" align=center>第 <%=Mypage%>/<%=Maxpages%> 页,每页
<%=MyPageSize%> 条
<%
url="Result.asp?action="&request("action")&"&keyword=" & keyword
PageNextSize=int((MyPage-1)/PageShowSize)+1
Pagetpage=int((total-1)/rs.PageSize)+1
if PageNextSize >1 then
PagePrev=PageShowSize*(PageNextSize-1)
Response.write "<a class=black href='" & Url & "&page=" & PagePrev & "' title='上" & PageShowSize & "页'>上一翻页</a> "
Response.write "<a class=black href='" & Url & "&page=1' title='第1页'>页首</a> "
end if
if MyPage-1 > 0 then
Prev_Page = MyPage - 1
Response.write "<a class=black href='" & Url & "&page=" & Prev_Page & "' title='第" & Prev_Page & "页'>上一页</a> "
end if
if Maxpages>=PageNextSize*PageShowSize then
PageSizeShow = PageShowSize
Else
PageSizeShow = Maxpages-PageShowSize*(PageNextSize-1)
End if
If PageSizeShow < 1 Then PageSizeShow = 1
for PageCounterSize=1 to PageSizeShow
PageLink = (PageCounterSize+PageNextSize*PageShowSize)-PageShowSize
if PageLink <> MyPage Then
Response.write "<a class=black href='" & Url & "&page=" & PageLink & "'>[" & PageLink & "]</a> "
else
Response.Write "<B>["& PageLink &"]</B> "
end if
If PageLink = MaxPages Then Exit for
Next
if Mypage+1 <=Pagetpage then
Next_Page = MyPage + 1
Response.write "<a class=black href='" & Url & "&page=" & Next_Page & "' title='第" & Next_Page & "页'>下一页</A>"
end if
if MaxPages > PageShowSize*PageNextSize then
PageNext = PageShowSize * PageNextSize + 1
Response.write " <A class=black href='" & Url & "&page=" & Pagetpage & "' title='第"& Pagetpage &"页'>页尾</A>"
Response.write " <a class=black href='" & Url & "&page=" & PageNext & "' title='下" & PageShowSize & "页'>下一翻页</a>"
End if
end if
rs.close
%>
</td>
</tr>
<tr>
</tr>
</table></td>
</tr>
<tr>
<td valign=top> </td>
</tr>
</table></td>
</tr>
<tr>
<td width="1" bgcolor="#cccccc"><img name="" src="" width="1" height="1" alt=""></td>
</tr>
</table>
<!--#include file=include/bottom.asp -->
</body>
</html>
引用:
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e21'
ODBC 驱动程序不支持所需的属性。
/Result.asp,行160
我以前也出现过类似的现像,原因是rs对象属性不支持,[1]表示当文件在编辑中时是不允许操作的,把1改为3就可以了.
set rs=server.CreateObject("ADODB.RecordSet")
rs.Source="select * from type order by typeorder"
rs.Open rs.Source,conn,1,1 (这里是160行)
修改为:
set rs=server.CreateObject("ADODB.RecordSet")
rs.Source="select * from type order by typeorder"
rs.Open rs.Source,conn,1,3 (这里是160行)
你试一吧,看可不可以.
我把rs.Open rs.Source,conn,1,1 改为rs.Open rs.Source,conn,1,3后,仍不行,显示如下错误提示:
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e07'
[Microsoft][ODBC Microsoft Access Driver] 内存溢出
/Result.asp,行160
再想方法啊!!