Cannot connect to password encrypted MS Access 2016 database using C#


Cannot connect to password encrypted MS Access 2016 database using C#



When I try to connect to a MS Access 2016 database, it connects perfectly without password, but when I try to connect to the same database after encrypting it with a password, I get this error:



Cannot open the database. It may not be a database that your application recognizes, or the file may be corrupt.



I don't know what I should do - my database isn't corrupted, and I have to make it with a password. Is there a way to do it, or am I wrong in something?



File extension is .accdb


.accdb



Screenshots:



https://drive.google.com/open?id=1vhp7pID4iQ_zoc6ImWXoJDFQv10qNRRn



https://drive.google.com/open?id=18QbuFhDU11YuYS-Pe1jxxIhtLPeff-lC





post your connection string here
– Sachith
Jun 30 at 19:13





@Sachith i don't use connection string i'm connecting with data server in visual and uploaded 2 photos.
– Mostafa
Jun 30 at 19:31





Did you install Microsoft Access Database Engine 2010 Redistributable?
– Sachith
Jun 30 at 19:32


Microsoft Access Database Engine 2010 Redistributable





yes i have installed it the database works without password the only problem is when i encrypt it with password
– Mostafa
Jun 30 at 19:37




1 Answer
1



Hope your connection string as follows,


"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=[Path];Jet OLEDB:Database Password=[Password];"



So, you used Microsoft.ACE.OLEDB.12.0 driver and must be installed on your machine, as it doesn't come with windows. you can find the driver on this link


Microsoft.ACE.OLEDB.12.0 driver



And hope this post also help to you. and also this



How to use access connection strings: https://www.connectionstrings.com/access/





Probem solved after uinstalling AccessDatabaseEngine 64 and installing AccessDatabaseEngine 32 thank you !.
– Mostafa
Jun 30 at 19:50







By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

List of Kim Possible characters

Audio Livestreaming with Python & Flask

NSwag: Generate C# Client from multiple Versions of an API