日期:2014-05-17  浏览次数:20793 次

asp+access connect string
dim   conn,connstr,DBx,rs
DBx= "../db/database.mdb "
DBPath   =   Server.MapPath(DBx)  
connstr   = "driver={Microsoft   Access   Driver   (*.mdb)};dbq= "   &   DBPath  
response.write   connstr
On   Error   Resume   Next
Set   conn   =   Server.CreateObject( "ADODB.Connection ")
conn.open   connstr
If   Err   Then
err.Clear
Set   Conn   =   Nothing
Response.Write   "数据库连接出错,请检查连接字串。 "
Response.End
End   If

=====================================================
老是连不上,打印出 "数据库连接出错,请检查连接字串。 "
换成
connstr= "Provider=Microsoft.Jet.OLEDB.4.0;Data   Source= "   &   Server.MapPath( " "&DBx& " ")
也是一样

------解决方案--------------------
Set conn = Server.CreateObject( "ADODB.Connection ")
conn.Provider= "Microsoft.Jet.OLEDB.4.0 "
conn.Open Server.MapPath( "..\db\database.mdb ")

肯定链接得成功
------解决方案--------------------
我想是系统的问题.