(一) 使用OLE DB方式
********************************************************
*** OLE DB Provider for Microsoft Jet
********************************************************
Dim oConn,strConn
Set oConn=Server.CreateObject("ADODB.Connection")
StrConn= "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:/somepath/myDb.mdb;" & _
"User Id=admin;" & _
"Password=;"
oConn.Open strConn
********************************************************
*** OLE DB Provider for ODBC Databases
********************************************************
访问MS Access数据库
Dim oConn,strConn
Set oConn=Server.CreateObject("ADODB.Connection")
StrConn= "Provider=MSDASQL;" & _
"Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=c:/somepath/mydb.mdb;" & _
"Uid=myUsername;" & _
"Pwd=myPassword;"
oConn.Open strConn
(二) 使用ODBC方式
********************************************************
*** ODBC Driver for Access
********************************************************
Dim oConn,strConn
Set oConn=Server.CreateObject("ADODB.Connection")
StrConn= "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq="&Server.MapPath("Testdb.mdb"); & _
"Uid=AdminAccount;" & _
"Pwd=Password;"
oConn.Open strConn
新闻热点
疑难解答