首页 新闻 会员 周边

关于asp数据库链接

0
悬赏园豆:5 [已解决问题] 解决于 2012-01-07 19:28

Access = "sss.mdb"     '数据库路径


connstr="DBQ="+server.mappath(Access)+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
If err Then
err.clear
Set Conn = nothing
response.write "数据库连接出错,请检查连接字串。"
response.end
end If

 

上面这一段提示“数据库连接出错,请检查连接字串”请问该怎么修改啊

青楼歌姬的主页 青楼歌姬 | 初学一级 | 园豆:122
提问于:2012-01-05 13:53
< >
分享
最佳答案
1
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<%
dim Access
Access = "Test.mdb" '数据库路径
connstr="DBQ="+server.mappath(Access)+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
If err Then
err.clear
Set Conn = nothing
response.write "数据库连接出错,请检查连接字串。"
response.end
end If
%>

</body>
</html>

我试了下,发现是没有问题的啊。莫非其他地方有问题。

收获园豆:5
NetSQL | 小虾三级 |园豆:1737 | 2012-01-05 20:21
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册