无法使用 C# 连接到密码加密的 MS Access 2016 数据库

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

当我尝试连接到 MS Access 2016 数据库时,无需密码即可完美连接,但是当我尝试使用密码加密后连接到同一数据库时,出现此错误:

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

我不知道该怎么办 - 我的数据库没有损坏,但我必须输入密码。有没有办法做到这一点,还是我哪里错了?

文件扩展名为 .accdb

截图:

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

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

希望你的连接字符串如下,

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

因此,您使用了 Microsoft.ACE.OLEDB.12.0 driver 并且必须安装在您的机器上,因为 windows 没有附带它。你可以在 link

上找到驱动程序

并希望这个 also help to you. and also this

如何使用访问连接字符串:https://www.connectionstrings.com/access/