In this article I will explain with an example, how to resolve the following error while making use of Excel 2007 or higher or Access 2007 or higher files using OLEDB connection in C# or VB.Net.
The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.
Error
The following error occurs when you make use of Excel 2007 or higher or Access 2007 or higher files using OLEDB connection in C# or VB.Net.
This happens only for Office 2007 or higher as it requires use of OLEDB ACE drivers for connection which do not come by default in Windows.
Solution
The solution to this problem is to make sure Office System Drivers are installed.
Downloading the Office System Drivers
Download the Microsoft Access Database Engine 2010 Redistributable using the following download link.
Steps
1. You will need to click the Download button shown in the below screenshot.
2. Once you click Download it will prompt you to select the architecture i.e. 32 BIT (x86) or 64 BIT (x64) and click the Download button.
Installing AccessDatabaseEngine
Steps
1. The .exe file will be downloaded as shown below.
2. Right click on the downloaded file and click Open.
3. Simply click the Next in order to move forward.
4. Here, accept the terms in the License Agreement by checking the CheckBox and click Next.
5. Browse the location where you want to install the Microsoft Office and click Install.
6. Finally, the Setup will be completed successfully.
`
If problem persists
If still you are getting error and if the error is in Visual Studio then, you will need to check the architecture of the Visual Studio application.
In order to check, you will need to open Task Manager and then look for devevn.exe which is the name of the EXE file of Visual Studio if it shows *32 it means that the Visual Studio is a 32 BIT application.
Thus, in such case, you will need to uninstall the 64 BIT (x64) version of the driver and then download and install 32 BIT version of Microsoft Access Database Engine 2010 Redistributable file.