纯手工打银:救急呀!!!这是我的错误,Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/16 08:19:06
<%@LANGUAGE="VBSCRIPT" %>
<!--#include file="conn.asp"-->
<%
dim keyword
dim boardid
dim i
keyword=cstr(request.form("keyword"))

boardid=request.form("boardid")

set rs= server.createobject("adodb.recordset")
rs.open "select * from "&boardid&" where title like '%"&keyword&"%'",conn,1,3
if rs.bof and rs.eof then
response.write"对不起,没有结果请扩大搜索范围"
else
total=rs.recordcount
all=total
while total>0
title=rs("title")
id=rs("id")
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>查询结果</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<style type="text/css">
<!--
.txt1 {
font-family: "宋体";
font-size: 9pt;
text-decoration: none;
}
-->
</style>
</head>

<body>
<table width="100%" border="0" class="txt1">
<tr>
<td>您好,数据库里共有<%=all%>条记录符合查询条件:</td>
</tr>
</table>
<table width="57%" border="0">
<tr>
<td width="16%" class="txt1"><%=rs("id")%></td>
<td width="84%" class="txt1"><a href="#" onClick="MM_openBrWindow('display.asp?boardid=<%=boardid%>&id=<%=id%>','','scrollbars=yes,width=450,height=600')"><%=rs("title")%></td>
</tr>
</table>
<p> </p>
</body>
</html>

<%
total=total-1
rs.movenext
wend
end if%>
这是源码部分

Microsoft OLEDBProviderforODBCDrivers(0x80040E14)的错误解释:

sql语句出错(字段名错误,或数据类型不匹配)
<%
rs.open "select * from "&boardid&" where title like '%"&keyword&"%'",conn,1,3
%>
boardid是什么类型?如果是字符串型的话,请这样写查询语句
rs.Open "select * from '" & boardid & "' where title like '% "& keyword &"%'",conn,1,3
如果不是字符串型的话,那么你的数据库查询语句有错误,我不知道你的数据库要查询的表名是什么,没法给出查询语句。请自己检查一下,

什么啊?网页打不开了?