I have been encountering this error for about a month now and I've tried just about every solution I could find online but still I have no luck! When attempting to connect to my Microsoft Access Database in Visual Studio 2022 using the server explorer this error is thrown every single time. I'm developing on a Parallels Windows 11 Virtual Machine due to the fact my computer is a MacBook Pro, and the VM is a 64 bit device. I'm very close to giving up all together and just buying a new Windows Computer just to try and get around this problem, so any help you may have will be greatly appreciated!
I've already attempted to install all the Microsoft Access Database Engine Redistributable's but I still receive this error. I have also attempted to change the target platform but still I keep receiving the same error. Every forum or video I've seen so far has given these 2 solutions so I'm not sure where to go from here!
Well, a few things.
First up, are you forcing the project to x32 bits, or x64 bits? This issue matters boatloads. While .net code can run as ANY CPU, un-managed Windows code cannot, and your .net project thus has to match the bit size of the Access data engine you installed.
Keep in mind that use of vs2022 results in additional issues. If you using the x32 (x86) version of Access, then you can use the connection builder in vs2022, but the test connection button WILL not work, and will NEVER work!
However, when you run your code (assuming forced to x32 bits), then the code should run and the connection to the Access data engine should work fine.
So, keep in mind that Visual Studio (VS) for 2022 is the first version of VS that is x64 bits. This means that the wizards and connection builders can be used, but not in all cases. The better solution is to then install the x64 bit version of the Access data engine.
While you can set your project to x32 bits, and build such projects? And EVEN build the connection?
The test connection button will not work. And it will not work regardless of your bit size setting for the project. (The reason is the connection builder is x64 bits now, and it can't verify a connection to a x32 bit version of Access).
Of course, if you install the x64 bit version of Access? Then yes, both the connection builder AND ALSO the test connection will work.
So, just like an 8-bit Atari computer can't run 16-bit code? And you can't run 16-bit code on that 8-bit Atari?
Well, since the dawn of computers, YOU have the same issue, and thus you cannot ignore this issue of mixing x32 and x64 bit software.
So, let's assume you installed the Access data engine (x32 bit version). You don't have to install MS-access, and you don't even have to install the Access runtime. However, you will need to install the Access data engine.
So, first step, this link:
Microsoft Access Database Engine 2016 Redistributable https://www.microsoft.com/en-us/download/details.aspx?id=54920
From above, you will eventually wind up with 2 choices.
So, we will assume x32 bit version.
So, from vs2022, let's build and setup the connection.
So, from VS in project properties, settings, we build the connection as follows:
Note VERY close in above:
We did not use the test connection button. It will NOT work since we using access x32, and VS is x64 bits.
Note very closely, we clicked on the advanced tab, and choose the ACE data engine, and NOT the JET data engine. Do NOT skip this step of using the Advanced button.
So, now make sure the project is set to x32 bits, here:
We will assume access x32 (x86) bits.
If you don't have a x32 (x86) option, then add a new configuration, and make sure you set the project to x32 bits.
So, as noted, we can't use test connection, but we can certainly use that connection. And you can use f5 to run, even in debug mode.
So, in a form, let's drop in a button, and a grid view.
The button code is this:
And the result is now this: