Dim MyConn As New ADODB.Connection
MyConn.Provider = "Microsoft.Jet.OLEDB.3.51"
MyConn.Properties("Data Source") = "C:\...\JetSecurity.MDB"
MyConn.Properties("Jet OLEDB:System database") = "C:\...\System.MDW"
MyConn.Open UserID:="Admin", Password:="MyPwd"
-或-
Dim MyConn As New ADODB.Connection
Dim strConn As String
strConn = "Data Source=C:\...\JetSecurity.MDB;" & _
"Jet OLEDB:System database=C:\...\System.MDW"
MyConn.Provider = "Microsoft.Jet.OLEDB.3.51"
MyConn.Open ConnectionString:=strConn, _
UserID:="Admin", Password:="MyPwd"
-或-
Dim MyConn As New ADODB.Connection
Dim strConn As String
strConn = "Provider=Microsoft.Jet.OLEDB.3.51;"
"Data Source=C:\...\JetSecurity.MDB;" & _
"Jet OLEDB:System database=C:\...\System.MDW"
MyConn.Open ConnectionString:=strConn, _
UserID:="Admin", Password:="MyPwd"
注意:Jet 3.51 OLEDB provider 被设计用来打开Access97数据库,如果你要打开Access 2000 请使用Jet 4.0 OLEDB provider,当然Jet 3.51 OLEDB provider也能打开Access 97。
如果你希望使用Jet 4.0只要将Microsoft.Jet.OLEDB.3.51换成Microsoft.Jet.OLEDB.4.0 |