ADO資料物件用來連線資料庫的方式有兩種,分別是ODBC和OLE DB方式
(一) 使用OLE DB方式
********************************************************
*** OLE DB Provider for Microsoft Jet
********************************************************
Dim oConn,strConn
Set oConn=teObject("ection")
StrConn= "Provider=B.4.0;" & _
"Data Source=c:;" & _
"User Id=admin;" & _
"Password=;"
strConn
********************************************************
*** OLE DB Provider for ODBC Databases
********************************************************
訪問MS Access資料庫
Dim oConn,strConn
Set oConn=teObject("ection")
StrConn= "Provider=MSDASQL;" & _
"Driver={Microsoft Access Driver (*)};" & _
"Dbq=c:;" & _
"Uid=myUsername;" & _
"Pwd=myPassword;"
strConn
(二) 使用ODBC方式
********************************************************
*** ODBC Driver for Access
********************************************************
Dim oConn,strConn
Set oConn=teObject("ection")
StrConn= "Driver={Microsoft Access Driver (*)};" & _
"Dbq="&Server.MapPath(""); & _
"Uid=AdminAccount;" & _
"Pwd=Password;"
strConn
Copyright ©2024 才華齋 All Rights Reserved.