回 帖 发 新 帖 刷新版面

主题:这段话我写错了吗?为什么连不到数据库?

<%
db="bdb/db.asp"
response.Buffer=true
on error resume next
[color=FF0000]set fso=server.createObject("Scripting.FileSystemObject")[/color]
if fso.FolderExists(server.MapPath("bdb/db.asp"))=false then
db="../"&db
end if
set fso=nothing
set conn=server.createObject("adodb.connection")
connstr="provider=microsoft.jet.oledb.4.0;data source="&server.mapPath(db)
conn.open connstr
%>
这段话我写错了吗?为什么连不到数据库?

回复列表 (共3个回复)

沙发

报什么错了?

板凳

创建fso应该没有错,
if not fso.FileExists(server.MapPath("bdb/db.asp"))=false then
是不是你检查文件写成检查文件夹啦?你试下吧

3 楼

on error resume next
把这个去掉!!看一下有什么错误提示..

我来回复

您尚未登录,请登录后再回复。点此登录或注册