Run SQL on another DB using a password

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to use ADO to execute a SQL command on another Access DB that is
password protected. Can someone please post example code on how to deliver
the SQL?

Thanks.
 
According to Carl Prothman's site
http://www.carlprothman.net/Default.aspx?tabid=87#OLEDBProviderForMicrosoftJet
assuming you mean password-protected, as opposed to User-Level Security
(where you need to supply a user id and a password), your connection string
would look like:

"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\mydb.mdb;" & _
"Jet OLEDB:Database Password=MyDbPassword", _
"myUsername", "myPassword"

(I have to admit I'm surprised about having to supply myUsername and
myPassword: try it without that)

If you do have ULS, you'd use

"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\mydb.mdb;" & _
"Jet OLEDB:System Database=MySystem.mdw", _
"myUsername", "myPassword"
 
Back
Top