Hi - I'm trying to remove the passwords on Access 97 databases that were set using DAO. All my experience is in ADO and I want to avoid using DAO at all costs. I know ADOX can alter passwords and permissions but so far I have failed to get it to work.
The following code causes an exception for some reason:
If anyone knows the answer, it would be much appreciated.
Cheers - Phil
The following code causes an exception for some reason:
Code:
ADODB::_ConnectionPtr pConn;
_CatalogPtr pCatalog;
_UserPtr pUser;
_bstr_t bstrConn("Provider=Microsoft.Jet.OLEDB.4.0;"
"Data Source=E:\\test\\old.mdb;"
"User Id=Admin;"
"Jet OLEDB:Database Password=MyPassword;");
CoInitialize(NULL);
pConn.CreateInstance(__uuidof(ADODB::Connection));
pCatalog.CreateInstance(__uuidof(Catalog));
pConn->Open(bstrConn, "", "", ADODB::adConnectUnspecified));
pCatalog->PutActiveConnection(_variant_t((IDispatch*)
pConn));
// Remove existing password
pUser = pCatalog->Users->GetItem("admin"); // exception!
pUser->ChangePassword("MyPassword", ""));
pConn->Close();
CoUninitialize();
If anyone knows the answer, it would be much appreciated.
Cheers - Phil