| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 444 人关注过本帖
标题:请教ASP运行错误问题
只看楼主 加入收藏
psyqin
Rank: 1
等 级:新手上路
帖 子:68
专家分:0
注 册:2006-7-15
结帖率:50%
收藏
 问题点数:0 回复次数:5 
请教ASP运行错误问题

我的网站上有个搜索框,一直运行正常,昨天突然就不能用了,一搜索就出现这样的错误提示:

Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e21'
ODBC 驱动程序不支持所需的属性。

/Result.asp,行160


这里的Result.asp,行160 代码如下:
rs.Open rs.Source,conn,1,1

请问这是什么原因,怎样修改?

搜索更多相关主题的帖子: ASP 运行 
2006-07-17 17:56
︶ㄣ墨少ゞ︶
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2006-7-18
收藏
得分:0 
改为"rs.Open rs.Source,conn,1,1"或者"conn.execute(sql)"这样的形式看看

2006-07-18 11:02
hangxj
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:2045
专家分:0
注 册:2006-4-10
收藏
得分:0 
贴代码上来

http://www./
2006-07-18 12:43
psyqin
Rank: 1
等 级:新手上路
帖 子:68
专家分:0
注 册:2006-7-15
收藏
得分:0 

按照第一楼说法去改不行,现把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 >&nbsp;"
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>

2006-07-18 17:46
seal520_2008
Rank: 1
等 级:新手上路
帖 子:239
专家分:0
注 册:2006-6-13
收藏
得分:0 


上面用了:

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")
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


知道哪里错了没?


每晚0:00上线 msn:seal520_2008@ myblog:http://seal.
2006-07-18 21:09
psyqin
Rank: 1
等 级:新手上路
帖 子:68
专家分:0
注 册:2006-7-15
收藏
得分:0 

没有看出哪里有错,请明示!

2006-07-19 08:57
快速回复:请教ASP运行错误问题
数据加载中...
 
   



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

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