4
votes

I have been trying to access the MS Access database file residing on my machine and it works just fine when I have office installed.

When I try to use the same code on a machine that does not have office installed/driver installed it throws up an error "Microsoft.ACE.OLEDB.12.0 provider is not registered"

I followed up on this post Microsoft.ACE.OLEDB.12.0 provider is not registered but the solution here is to install the redistributable physically.while I would like to do it programmatically using C#.

Would that be possible only by installation physically, is this the only way out?

1

1 Answers

7
votes

If your application uses the Microsoft.ACE.OLEDB.12.0 driver then that driver must be installed on the machine. To (directly) access the database file "programmatically using C#" would essentially involve you (re-)writing Jackcess in C#. That would be a huge amount of work and would make no real sense (since the proper ACE.OLEDB driver for Windows is already freely available).

One alternative would be to use the Microsoft.Jet.OLEDB.4.0 driver instead. The (32-bit) Jet driver is installed with every copy of Windows. However, you would face the following restrictions:

  1. Your application would only be able to manipulate .mdb files, not .accdb files, and
  2. Your application would have to be built as a 32-bit application.