急救 !在线等 错误:Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
/sits/sites/vod/search.asp, 第 147 行
浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)
以下是 代码:
问题点数:20、回复次数:19Top
1 楼whzh719()回复于 2006-05-22 14:00:59 得分 0
<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<%
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
dim keyword
dim sql
dim rs
dim founderr
dim errmsg
dim findword
founderr=false
keyword=request("keyword")
if keyword="" then
errmsg=errmsg+"<br>"+"请输入查询条件。"
founderr=true
else
if request("action")="title" then
findword="showname like '%"&keyword&"%' "
else
findword="note like '%"&keyword&"%' "
end if
end if
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
set rs=server.createobject("adodb.recordset")
dim classid,Nclassid
dim classname,Nclassname
if request("classid")="" then
classid=""
classname="所有影片"
else
classid="classid="&cstr(request("classid"))&" and "
sql="select class from class where classid="&cstr(request("classid"))
rs.open sql,conn,1,1
classname="[<font color=#008000>"&rs("class")&"</font>]"
rs.close
end if
if request("Nclassid")="" then
Nclassid=""
Nclassname="所有影片"
else
Nclassid=" Nclassid="&cstr(request("Nclassid"))&" and "
sql="select Nclass from Nclass where Nclassid="&cstr(request("Nclassid"))
rs.open sql,conn,1,1
Nclassname="的[<font color=#008000>"&rs("Nclass")&"</font>]分类"
rs.close
end if
%>
<HTML><HEAD><TITLE>查找结果(<%=keyword%>)</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<link rel="stylesheet" href="images/style.css">
<SCRIPT language=javascript>
function popwin2(id,path)
{ window.open("openarticle.asp?id="+id+"&ppath="+path,"");
}
</SCRIPT>
<style type="text/css">
<!--
.textfield1 {border-bottom:#000000 1px solid; background-color:#FFFFFF; border-left:#000000 1px solid; border-right:#000000 1px solid; border-top:#000000 1px solid; font-size: 9pt; font-family:"宋体";}
-->
</style>
</HEAD>
<!--#include file="topMain.asp"-->
<div align="center">
<center>
</center>
</div>
<%if founderr=true then%>
<table border="0" width="752" height="300" cellpadding="0" cellspacing="1" bgcolor="#B05706" align="center">
<tr>
<td width="24%" bgcolor="#E8F0F8" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#B05706" height="40">
<form method="post" name="myform" action="search.asp">
<tr>
<td bgcolor="#E8F0F8" valign="middle" align="center"> 搜索:
<input type="text" name="keyword2" class=textfield1 size=10 maxlength="50" style="font-family: Arial">
<input type="submit" name="Submit" value="搜索" style="height='21'" class="botton"> </td>
</tr>
</form>
</table>
</td>
<td width="76%" bgcolor="#FFFFFF" valign="top">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="5"></td>
</tr>
<tr>
<td background="images/bj4.gif" height="1"><img src="images/spacer.gif" width="1" height="1"></td>
</tr>
</table>
<table width="98%" border="0" align="center">
<tr>
<td>您的位置:<a href="index.asp">首页 >></a>
<%
response.write "查询条件:<font color=red>"&keyword&"</font>"
response.write "在"&classname&""&Nclassname&"中"
%>
</td>
</tr>
</table>
<br><br><br><br><br><br><br>
<div align="center">关键字不能为空!</div>
</td>
</tr>
</table>
<%else%>
<table border=0 cellpadding=0 cellspacing=1 width=752 align="center">
<tr>
<td valign="top" width="182" bgcolor="#E8F0F8">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#B05706" height="40">
<form method="post" name="myform" action="search.asp">
<tr>
<td bgcolor="#E8F0F8" valign="middle" align="center"> 搜索:
<input type="text" name="keyword" class=textfield size=10 maxlength="50" style="font-family: Arial">
<input type="submit" name="Submit" value="搜索" style="height='21'" class="botton">
</td>
</tr>
</form>
</table>
<TABLE border=0 cellpadding=0 cellspacing=0 width=182 align="center">
<TR>
<TD bgcolor=#B05706 height="20">
<div align="center"><FONT color=#ffffff>今日下载Top10</FONT></div>
</TD>
</TR>
<TR align=middle>
<TD bgcolor=#999999 valign="top">
<TABLE border=0 cellpadding=0 cellspacing=0 width=100% height="100">
<TR>
<TD bgcolor=#E8F0F8 valign=top width="191"><FONT style="line-height:150%">
<%
dim tdate
tdate=year(Now()) & "-" & month(Now()) & "-" & day(Now())
sql="select * from download where "
sql=sql&" lasthits='"&tdate&"'and dayhits >0 "
sql=sql&" order by dayhits desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
%>
本日没有下载
<%else%>
<%do while not rs.eof
response.write "<LI><A href=list.asp?id="&rs("id")&">"&rs("showname")&" "&rs("bb")&"</A></LI>"
i=i+1
if i>=10 then exit do
rs.movenext
loop
i="0"
end if
rs.close
%>
</FONT> </TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</td>
<td valign=top width=568 height="160" bgcolor="#FFFFFF">
<div align="right">
<table width="98%" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td height="5"></td>
</tr>
<tr>
<td background="images/bj4.gif" height="1"><img src="images/spacer.gif" width="1" height="1"></td>
</tr>
</table>
<table width="98%" border="0" align="center">
<tr>
<td>您的位置:<a href="index.asp">首页 >></a>
<%
response.write "查询条件:<font color=red>"&keyword&"</font>"
response.write "在"&classname&""&Nclassname&"中"
%>
</td>
</tr>
</table>
<br>
<TABLE border="0" cellspacing="1" cellpadding="1" bgcolor="#999999" width="98%" align="center">
<TR>
<TD valign="top" align="center" bgcolor="#FFFFFF">
<TABLE border="0" width="98%" cellspacing="0" cellpadding="0" align="center">
<TR bgcolor="#FFFFFF">
<TD bgcolor="#FFFFFF" height="22"> <BR>
</TD>
<TD align=right width="28%" height="22" nowrap>
<FORM action="sort.asp" method=get>
总分类:
<SELECT name="classid" size="1" onChange='javascript:submit()' class="textfield">
Top
2 楼whzh719()回复于 2006-05-22 14:01:10 得分 0
<%
sql="select class,classid from class"
rs.open sql,conn,1,1
if rs.bof and rs.eof then
%>
<OPTION value="">Not Record!</OPTION>
<%else%>
<%
do while not rs.eof
%>
<OPTION <%if request("classid")<>"" then%><%if cint(rs("classid"))=cint(request("classid")) then%> selected <%end if%><%end if%>value="<%=rs("classid")%>"><%=rs("class")%></OPTION>
<%
rs.movenext
loop
end if
rs.close
%>
</SELECT>
</FORM>
</TD>
<TD width="29%" height="22" nowrap>
<FORM action="sort.asp" method=get>
子分类:
<SELECT name="Nclassid" size="1" onChange='javascript:submit()' class="textfield">
<%
if request("classid")="" then
sql="select Nclass,Nclassid from Nclass"
else
sql="select Nclass,Nclassid from Nclass where classid="&request("classid")
end if
rs.open sql,conn,1,1
if rs.bof and rs.eof then
%>
<OPTION value="">Not Record!</OPTION>
<%else%>
<%
do while not rs.eof
%>
<OPTION <%if request("Nclassid")<>"" then%><%if cint(rs("Nclassid"))=cint(request("Nclassid")) then%> selected <%end if%><%end if%>value="<%=rs("Nclassid")%>"><%=rs("Nclass")%></OPTION>
<%
rs.movenext
loop
end if
rs.close
%>
</SELECT>
</FORM>
</TD>
</TR>
</TABLE>
<%
if request("Nclassid")="" then
sql="select id,showname,bb,note,hits,dateandtime,hot,size,system,orders from download where "&classid&" "&findword&" "
sql=sql&" order by id desc"
else
sql="select id,showname,bb,note,hits,dateandtime,hot,size,system,orders from download where "&classid&" "&Nclassid&" "&findword&" "
sql=sql&" order by id desc"
end if
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<p align='center'>没有或没有找到任何信息<br><br><br><b>提示:搜索影片时请不要填入版本号!</b><br><Br></p>"
else
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showContent
showpage totalput,MaxPerPage,"search.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"search.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"search.asp"
end if
end if
rs.close
end if
sub showContent
dim i
i=0
%>
<TABLE border="0" cellspacing="0" cellpadding="0" align=center width="98%">
<TR>
<TD width="37%" height=22>影片名称和简介</TD>
<TD width="18%" align="center">推荐</TD>
<TD width="18%" align="center">更新日期</TD>
<TD width="13%" align="center">下载次数</TD>
<TD width="14%" align="center">文件大小</TD>
</TR>
<%do while not rs.eof%>
<TR>
<TD width="100%" colspan="5" height=23><A href="list.asp?id=<%=rs("id")%>"><%=replace(rs("showname"),""&keyword&"","<font color=red>"&keyword&"</font>")%> <%=rs("bb")%></A></TD>
</TR>
<TR>
<TD width="37%" height=22>
<%if len(rs("note"))>18 then%>
<%=left(rs("note"),18)%>……
<%else%>
<%=rs("note")%>
<%end if%>
</TD>
<TD width="18%" align=center>
<%if rs("hot")>3 then%>
<FONT color=red>推荐</FONT>
<%end if%>
</TD>
<TD width="18%" align=center><%=rs("dateandtime")%></TD>
<TD width="13%" align=center><%=rs("hits")%></TD>
<TD width="14%" align=center><%=rs("size")%></TD>
</TR>
<TR>
<TD width="100%" colspan="5" height=11>运行环境:<%=rs("system")%>
授权方式:<%=rs("orders")%></TD>
</TR>
<TR align="center">
<TD width="100%" colspan="5"><hr size="1"></TD>
</TR>
<%
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
</TABLE>
<%
end sub
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
response.write "<form method=Post action="&filename&"?classid="&request("classid")&"&Nclassid="&request("Nclassid")&"&action="&request("action")&"&keyword="&keyword&">"
response.write "<font color='red'>"&Nclassname&"</font>"
if CurrentPage<2 then
response.write ""&totalnumber&"个 首页 上一页 "
else
response.write ""&totalnumber&"个 <a href="&filename&"?page=1&keyword="&keyword&">首页</a> "
response.write "<a href="&filename&"?page="&CurrentPage-1&"&keyword="&keyword&">上一页</a> "
end if
if n-currentpage<1 then
response.write "下一页 尾页"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)&"&keyword="&keyword&">"
response.write "下一页</a> <a href="&filename&"?page="&n&"&keyword="&keyword&">尾页</a>"
end if
response.write " 页次:<strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>页 "
response.write " <b>"&maxperpage&"</b>个影片/页 "
%>
<%
end function
%>
<%
set rs=nothing
conn.close
set conn=nothing
%>
</TD>
</TR>
</TABLE>
</div><br>
</td>
<%end if%>
<!--#include file="CopyRight.asp"-->
</table>
</BODY>
请问这是怎么会事
帮帮小弟了Top
3 楼sy_binbin()回复于 2006-05-22 14:06:00 得分 0
麻烦把第 147 行的代码贴出来Top
4 楼lnboy1003(陌生人)回复于 2006-05-22 14:07:14 得分 0
lasthits是什么数据类型的Top
5 楼heroooooo(学习.NET)回复于 2006-05-22 14:10:04 得分 1
rs.open sql,conn,1,1,这个是147行的东西.我觉得是你的连接数据库的地方有问题.数据源可能设置得有问题,不行就换个方式连接..Top
6 楼whzh719()回复于 2006-05-22 14:11:55 得分 0
<%
dim tdate
tdate=year(Now()) & "-" & month(Now()) & "-" & day(Now())
sql="select * from download where "
sql=sql&" lasthits='"&tdate&"'and dayhits >0 "
sql=sql&" order by dayhits desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1 《--------147行
if rs.eof and rs.bof then
%>
本日没有下载
<%else%>Top
7 楼knight0513(凯莱特)回复于 2006-05-22 14:12:18 得分 1
conn有问题,就是数据库连接有问题,可能是路径,驱动Top
8 楼whzh719()回复于 2006-05-22 14:16:23 得分 0
我这里面还有个登入窗口,提交时没问题,
就是搜索时有问题
,我感觉CONN应该没问题
我把CONN的代码贴出来
大家看看
怎么解决
CONN.ASP
<%
'on error resume next
dim conn
dim dbpath
set conn=server.createobject("adodb.connection")
dbpath="DBQ="+server.mappath("vod.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
conn.Open dbpath
%>
Top
9 楼heroooooo(学习.NET)回复于 2006-05-22 14:16:59 得分 1
你的错误提示没有什么有效的信息,看看你的conn.asp文件的内容..Top
10 楼sy_binbin()回复于 2006-05-22 14:20:28 得分 2
用OLEDB那种连接方法连接试试呢Top
11 楼heroooooo(学习.NET)回复于 2006-05-22 14:22:04 得分 7
<%
on error resume next
connstr="DBQ="+server.mappath("mynewdesignforum.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
%>Top
12 楼whzh719()回复于 2006-05-22 14:23:38 得分 0
是这种吗
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
我试过了,
问题没解了
有出现在新的问题
Top
13 楼heroooooo(学习.NET)回复于 2006-05-22 14:25:21 得分 1
有出现在新的问题
__________________
什么问题??错误提示,记得以后问问题时候要说清楚了..Top
14 楼sy_binbin()回复于 2006-05-22 14:29:41 得分 4
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")我一直在用这种方法的.没出现什么错误呢!
把你的错误信息贴出来Top
15 楼whzh719()回复于 2006-05-22 14:35:33 得分 0
<%
on error resume next
connstr="DBQ="+server.mappath("mynewdesignforum.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
%>
<%
'on error resume next
dim conn
dim dbpath
set conn=server.createobject("adodb.connection")
dbpath="DBQ="+server.mappath("vod.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
conn.Open dbpath
%>
用第一个可以
为什么后面这个不行呢
Top
16 楼whzh719()回复于 2006-05-22 14:41:43 得分 0
谢谢各位参与
我用下面这个就可以,但我不知道为什么,HEROOOOOOO可以说一下吧
<%
on error resume next
connstr="DBQ="+server.mappath("mynewdesignforum.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
%>Top
17 楼whzh719()回复于 2006-05-22 14:43:31 得分 0
小弟在此多谢谢各位的帮助Top
18 楼heroooooo(学习.NET)回复于 2006-05-22 14:50:34 得分 2
on error resume next,这个是不报错误,但是不代表没有问题,上面的两个程序没有区别,你现在看看你能不能操作数据库??
ps:这个on error resume next是一个容错语句,一般写程序的时候不要加上他,等所有的错误都搞顶之后再加上..Top
19 楼love01px(JAVA CUP)回复于 2006-05-22 15:56:26 得分 1
sql=sql&" lasthits='"&tdate&"'and dayhits >0 "
改为
sql=sql&" lasthits='"&tdate&"' and dayhits >0 "Top




