WOTR
June 21st, 2001, 08:31 AM
I wanted to attached .mdb file through programme using ADO. How do I?
|
Click to See Complete Forum and Search --> : ADO WOTR June 21st, 2001, 08:31 AM I wanted to attached .mdb file through programme using ADO. How do I? Ghost308 June 21st, 2001, 08:42 AM Well, i've never tried to connect to an mdb file using ADO (that's really what DAO is for), but according to a big book i paid a lot of money for, ADO can't handle the MS Jet Database format... otherwise known as Access mdb files. That just doesn't seem cool though, I'll keep lookin around to see if this has changed since this book was published. Iouri June 21st, 2001, 08:51 AM For Standard Security: oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _ "Dbq=\somepath\mydb.mdb;" & _ "Uid=Admin;" & _ "Pwd=;" If you are using a Workgroup (System database): oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _ "Dbq=\somepath\mydb.mdb;" & _ "SystemDB=\somepath\mydb.mdw;", _ "admin", "" 'latest and greatest sConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & DBNAME & _ ";Persist Security Info=False" Persist Security Info is important when db is password protected (False eliminate pwd protection?) '=================================================================== 'connection to secure database Dim Cnn As ADODB.Connection Dim Rst As ADODB.Recordset 'In the place where you want to establish your connection, such 'as the Initialize event of a class module, enter the following: Dim strConnect As String Set Cnn = New ADODB.Connection 'Substitute your own User IDs, Password, Data Source, and System 'database in the connection string below strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Password=MyPassword;User ID=Administrator;" & _ "Data Source=C:\AccessDBs\DB1.mdb;" & _ "Persist Security Info=True;" & _ "Jet OLEDB:System database=C:\AccessDBs\system.mdw" With Cnn .CursorLocation = adUseClient .Open strConnect End With Set Rst = New ADODB.Recordset Rst.ActiveConnection = Cnn Iouri Boutchkine iouri@RemoveThisTillHere.hotsheet.com codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |