Issue with Opening a Connection to a Password Protected Microsoft Access Database in the Visual Studio

When you are writing an application that make use of a Microsoft Access file as your database, and your database file is protect by a database password, you might encounter a following error while your connection string is correct:

MSAccess Connection Error

To fix this error, simply reduce the number of characters in your password of your database.

 

In addition to this article, I placed some connection strings that might be useful when you building your application that utilizes a MS Access file.

  • Connection string for a Access 2007 database with a password:
    Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\mydb.accdb;Jet OLEDB:Database Password=password;
  • ODBC:
    Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;Uid=Admin;Pwd=password;
  • OLEDB with a user password:
    Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydb.mdb;User Id=admin;Password=password;
  • OLEDB with a database password:
    Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydb.mdb;Jet OLEDB:Database Password=password;

Leave a Reply

Your email address will not be published. Required fields are marked *