新手提问:数据库连接错误: ODBC 驱动程序不支持所需的属性
asp吧
全部回复
仅看楼主
level 1
200903013 楼主
这是我的代码
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%
set conn=server.CreateObject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.MapPath("news.mdb")
exec="select * from news"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<table>
<%do while not rs.eof%><tr>
<td>
<a href=show.asp?id="&rs("ID")&" target=_blank><%=rs("title")%></a>
</td>
</tr>
<%rs.movenext
loop
%>
</table>
<%rs.close
set rs=nothing
conn.close
set conn=nothing%>
</body>
</html>
错误提示:
Microsoft OLE DB Provider for ODBC Drivers 错误
*800401f3*
ODBC 驱动程序不支持所需的属性。
/shownews.asp,行 8
就是rs.open exec,conn,1,1这句
改成1,3仍旧有错
2014年10月15日 13点10分 1
level 1
200903013 楼主
我百度的答案都不合适啊,一下午了没解决
2014年10月15日 13点10分 2
level 5
可能运行机器没有microsoft access driver (*.mdb)ODBC驱动
ODBC是一种较老的数据访问方案,建议用OLEDB访问数据库试试
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.MapPath("news.mdb")
修改为
conn.open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = "&server.MapPath("news.mdb")
2014年10月16日 03点10分 3
level 12
换驱动吧
楼上是一种办法 改用 oledb
主要 access 本身不提供游标
你要设置使用客户端游标 rs.cursorlocation=3
2014年10月16日 17点10分 4
1