Search code examples
databasevb.netms-accessvisual-studio-2019

Visual Studio - MS Access Working Database Connection then suddenly the provider is not found


I have a code that is already connected to an MS Access Database. When I opened Visual Studio 2019 again, under Data Connection, the database file has an x. When I tried to test the connection, it has an error of

The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the machine. 

I already installed the 'Microsoft Access database engine 2010 (English)' at x64 and it worked from my first install and when I tried running the code for the first time. Then this happened. I can't find the problem. Though when I run the code even if there wan an x on the database file and the error that the provider is not found, the log in of my program still works and determines the existing accounts.


Solution

  • If you force your project to x64 bits?

    Then you CAN use the connection builder, but the test connection button will NEVER work. In fact the test connection button NEVER worked, and NEVER works for x64 bit Access.

    However, WHEN you run your code, the connection should and will work.

    So:

    Access x64 - must set project to x64 bits. 
    Test connection NEVER works
    You can use connection builder(s).
    

    So for x64 Access (ACE), You MUST run the project for connections to work - test connection can't work since Visual Studio is a x32 bit program - it can't connect to a x64 bit driver. But F5 (debug) or run will work, since if you force the project to x64, then the project will launch and run as an x64 bit process.

    So, test connection NEVER EVER worked for x64 bit Access. You most likely ran your project - it works. But then attempted to try test connection - it will NEVER work. So ANY connection made to ACE/access MUST occur WHEN you run the project - during design time - test connection builders NEVER will work.

    Access x32 - you should set/force the project to x86.
    Test connection should work.
    You can use the connection builders.
    

    You can use "any cpu", but that ONLY works due to the fact that Visual Studio is a x32 bit application. As a result, when you hit say f5 to run, you get a x32 bit "in-process" running instance of your application. However, I don't recommend ANY cpu for x32 access. If the user launches that .net exe program from a x64 bit command line (easy to do), then your ANY cpu application will now run as x64 bits and not work an connect to access x32.

    So I STRONG recommend that you FORCE your project to the correct bit size and avoid and not use ANY cpu for the project settings.