asp 中连接access数据库相对路径的问题

2024-12-18 16:28:25
推荐回答(2个)
回答1:


MM_link_STRING = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=f:/web1/data.mdb"

改为

MM_link_STRING = "provider=microsoft.jet.oledb.4.0;" & "data source = " & server.mappath("data.mdb")

另外你的IIS默认站点路径应指向F:/web1/

回答2:

如果网站根目录是f:\web1
dim conn,connstr
on error resume next
connstr="DBQ="+server.mappath("data.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
Set conn=Server.CreateObject("ADODB.CONNECTION")
conn.open connstr
如果网站根目录是f:\
dim conn,connstr
on error resume next
connstr="DBQ="+server.mappath("web1\data.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
Set conn=Server.CreateObject("ADODB.CONNECTION")
conn.open connstr