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

余生颓废 提交于 2020-01-03 07:01:05

问题


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

Screenshots:

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

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


回答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

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

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



来源:https://stackoverflow.com/questions/51117757/cannot-connect-to-password-encrypted-ms-access-2016-database-using-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!