Search code examples
c#64-bitoledbdbf

Replacement for Jet.OLEDB.4.0 driver for a dbf file in a 64 bit Machine


I recently moved to a 64 bit OS machine. In my application written in C# .net, a code in a dll is trying to open a dbf file using Microsoft.Jet.OLEDB.4.0 driver. I found that OLEDB is not supported for 64 bit. Refer to this thread

I tried to install the new ACE.OLEDB.12.0. First I installed the 32 bit version of the engine, which was not recognized and received this error mesage "Microsoft.ACE.OLEDB.12.0 provider is not registered on the local machine".

So I tried to install the 64 bit version of the ACE.OLEDB, from here

Now I am facing an error as I have my other office products installed as 32-bit Office Products

How can I resolve this issue?

PS: I tried to set my solution to compile to x86 platform. It threw a BadImageFormatException.


Solution

  • OLEDB not being supported for 64 bit means that you can't load it into a 64 bit process, but if your process is 32 bit it will run just fine on a 64 bit machine. Windows has a very extensive compatibility layer to make 32 bit applications run on 64 bit machines.

    If you don't require 64 bit functionality in your application (as your PS line suggests) you should set to compile to x86 and use the 32 bit Jet driver with it. This should run fine on both 32 and 64 bit systems.

    On the BadImageFormatException, you probably tried to load the 64 bit dll into the 32 bit process.