Dim MyConn As New ADODB.Connection
MyConn.Provider = "Microsoft.Jet.OLEDB.4.0"
MyConn.Properties("Data Source") = "C:\...\JetPassword.MDB"
MyConn.Properties("Jet OLEDB:Database Password") = "MyPwd"
MyConn.Open
'--- or ---
Dim MyConn As New ADODB.Connection
Dim strConn As String
strConn = "Data Source=C:\...\JetPassword.MDB;" & _
"Jet OLEDB:Database Password=MyPwd"
MyConn.Provider = "Microsoft.Jet.OLEDB.4.0"
MyConn.Open strConn
'--- or ---
Dim MyConn As New ADODB.Connection
Dim strConn As String
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\...\JetPassword.MDB;" & _
"Jet OLEDB:Database Password=MyPwd"
MyConn.Open strConn
'If you are opening a database that uses Jet security, you can use
'any one of the following three syntaxes:
Dim MyConn As New ADODB.Connection
MyConn.Provider = "Microsoft.Jet.OLEDB.4.0"
MyConn.Properties("Data Source") = "C:\...\JetSecurity.MDB"
MyConn.Properties("Jet OLEDB:System database") = "C:\...\System.MDW"
MyConn.Open UserID:="Admin", Password:="MyPwd"
'--- or ---
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.4.0"
MyConn.Open ConnectionString:=strConn, _
UserID:="Admin", Password:="MyPwd"
'--- or ---
Dim MyConn As New ADODB.Connection
Dim strConn As String
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;"
"Data Source=C:\...\JetSecurity.MDB;" & _
"Jet OLEDB:System database=C:\...\System.MDW"
MyConn.Open ConnectionString:=strConn, _
UserID:="Admin", Password:="MyPwd"
'NOTE : Jet 3.51 OLEDB provider is designed to open Access 97
'databases only. Jet 4.0 OLEDB provider is designed to open Access
'2000 or Access 97 databases.
'If you must use the Jet 3.51 Provider in the above examples, change
'the provider name to "Microsoft.Jet.OLEDB.3.51."
'Starting with Microsoft Data Access Components (MDAC) version 2.6,
'MDAC no longer contains the following Jet components:
'- Microsoft Jet
'- Microsoft Jet OLE DB Provider
'- ODBC Desktop Database Drivers
'For additional information, click the article number below to view
'the article in the Microsoft Knowledge Base:
'Q239114 ACC2000: Updated Version of Microsoft Jet 4.0 Available in
'Download Center
'The "MDAC 2.5 Stack and Windows File Protection" white paper
'contains a full list of the components that are shipped with MDAC
'2.5, along with a discussion of Windows File Protection. Refer to
'this white paper for more information about the Jet dynamic-link
'libraries (DLLs) that are included in MDAC 2.5, which are no longer
'a part of MDAC 2.6.
'For more information about MDAC 2.5 and Windows File Protection, see
'the following Microsoft Web site:
'http://www.microsoft.com/data/mdacwfp.htm
Sumber: http://support.microsoft.com/default.aspx?scid=kb;EN-US;q191754
No comments:
Post a Comment