If you are running on a 64 bit system and your assembly target is Any CPU or x64 then you will see this exception:
The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.
The Microsoft ACE.OLEDB driver for MDB and ACCDB files works OK whichever platform is targeted. However this driver is not installed by default on user computers unlike the Jet driver.
This fix can be used to make existing code work with Jet/MDB, eg the Cassini server.
Useful blog links:
- Force .NET application to run in 32bit process on 64bit OS by Gabriel Schenker
- Back to Basics: 32-bit and 64-bit confusion around x86 and x64 and the .NET Framework and CLR by Scott Hanselman