帮我看看吧,sql数据库换成access出错了!

iwo99 2002-03-21 09:17:52
我原来用asp+sql作了一个程序,现在我想换成sql+access但是我把数据库连接换了后就不稳定了,老是出Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)的错误。我不知道为什么,是不是光换数据库连接文件不行,还有其它
的注意事项,恳请各位高手帮忙!!谢谢!!!
以下有一个错误原码,高手们帮帮忙吧!!!!!!!!!!!
conn.asp
<%
set conn=server.createobject("adodb.connection")
strconn = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("../include/book98.mdb")
conn.open strconn
%>
left.asp
<html>
<head>
<!-- #include file="../include/conn.asp" -->
<!--#include file="../include/adovbs.inc"-->
<!-- #include file="../include/css.css" -->

<script>
function focusit()
{
document.all("input").focus();
}
</script>

<title>所 有 分 类</title>

<base target="main">

</head>

<body onload="focusit()" background="../image/back_file.gif">
<div align="center">
<center>
<table border="1" width="55%" cellspacing="0" cellpadding="0" bordercolorlight="#99CCFF" bordercolordark="#FFFFFF" bgcolor="#E3FEDA">
<tr>
<td width="100%">
<form method="post" action="show.asp">
  <br>
 
<select size="1" name="chaxun">
<option >按书名查</option>
<option>按作者查</option>
<option>按主题词查</option>
<option selected>模糊查询</option>
</select><br>   <input type="text" name="input" size="12" style="width: 84; height: 20"><input type="submit" value="查询" name="查询" style="width: 34; height: 20">

</form>


</td>
</tr>
</table>



</center>
</div>



<TABLE cellSpacing=0 cellPadding=0 width="134" align=center
border=1 height="281" bgcolor="#CBE6B9" bordercolorlight='#99CCFF' bordercolordark='#FFFFFF' cellspacing=0>
<TR>
<TD height=29 width="132" bgcolor="#FFCC99">   
<b><font size="2" color="#0000FF">所 有 分 类</font></b></TD></TR>
<%
sql="select * from fenlei"
set rs=conn.execute(sql)
do while not rs.eof
%>

<TR>
<TD bgColor=#E3FEDA height="28" width="132"> <font size="2"><a href="show.asp?fenlei=<%=rs("分类号")%>"><%=rs("分类名称")%></a>(<font color=red>
<%
sql1="select count(*) from book where 分类号='"&rs("分类号")&"'and 权限='1'"
set rs1=conn.execute(sql1) ..........出错行!!!!!
response.write rs1(0)
%></font>)</font> </TD></TR>
<TR>

<% rs.movenext
loop
conn.close
set rs=nothing
set rs1=nothing
set conn=nothing
%>
<TR>
<TD bgColor=#FFCC99 height="28" width="132">  </TD></TR>

</TABLE>
</body>
<html>
出错提示:

错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
/book98/student/left.asp, 第 67 行
拜托各位了,谢谢!!!!!!

类似这样的问题很多,我不知道是哪里错了,帮帮忙高手急啊!!!

...全文
51 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
iwo99 2002-03-22
  • 打赏
  • 举报
回复
谢谢你!playmud(三少爷的剑)你说的是对的,我的数据库导过access后
"权限"是数字形式了,改成权限=1就行了,再次谢谢你!给分了!
playmud 2002-03-21
  • 打赏
  • 举报
回复
如果权限是数字形式的话用:权限=1
不要用:权限='1'
playmud 2002-03-21
  • 打赏
  • 举报
回复
加上空格呀!
iwo99 2002-03-21
  • 打赏
  • 举报
回复
我的and前是没有空格,BrightEye(问个不休)的办法我试过了,还是出错。
各位帮忙再看一看!
ysotn 2002-03-21
  • 打赏
  • 举报
回复
我认为 playmud(三少爷的剑)说得对:

sql1="select count(*) from book where 分类号='"&rs("分类号")&"' and 权限='1'" and前面没有空格。

BrightEye 2002-03-21
  • 打赏
  • 举报
回复
再加一句:
rs1.close
BrightEye 2002-03-21
  • 打赏
  • 举报
回复
sql1="select count(*) from book where 分类号='"&rs("分类号")&"'and 权限='1'"
set rs1=conn.execute(sql1) ..........出错行!!!!!

改为:
set rs1=Server.CreateObject(ADODB.RecordSet)
sql1="select count(*) from book where 分类号='"&rs("分类号")&"'and 权限='1'"
conn.execute sql1

slightgao 2002-03-21
  • 打赏
  • 举报
回复
检查sql语句。
如果sql语句不错的话,建议你将字段名设计成英文名。
janlon 2002-03-21
  • 打赏
  • 举报
回复
第六十七行的")"号是什么意思?有这个必要吗
iwo99 2002-03-21
  • 打赏
  • 举报
回复
上面有显示的“出错行.....”那一句,帮忙再看看
oh_net 2002-03-21
  • 打赏
  • 举报
回复
啊晕
希偌 2002-03-21
  • 打赏
  • 举报
回复
67行是哪一行?
playmud 2002-03-21
  • 打赏
  • 举报
回复
sql1="select count(*) from book where 分类号='"&rs("分类号")&"' and 权限='1'"
and前面是不是没有空格?

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧