Open password protected Access using ADO

  • Thread starter Thread starter Julie
  • Start date Start date
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
 
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.
 
Back
Top