Open password protected Access using ADO

J

Julie

I was working with Access using ADO. Everything went well
until I put password to protecte the Access database file
and tried to open it. Here is the code and it refuse to
open the Access file.

_ConnectionPtr pConnection = NULL;
pConnection.CreateInstance(__uuidof(Connection);

CString sSource(_T("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\test.mdb;"));
CString sPassword("123456");

pConnection->Open((LPCTSTR)sSource, "", (LPCTSTR)
sPassword, adConnectUnspecified);

Please help me if you knew the answer. My email
(e-mail address removed)

Julie
Please help me
 
D

Douglas J. Steele

Not sure what language that is you're using, but here's the connection
string required with a database password from Carl Prothman's
http://www.able-consulting.com/ado_conn.htm :

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

Note that database passwords really aren't very secure.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top