I'm trying to get data from an Excel file on a button click event. My connection string is:
string connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\source\\SiteCore65\\Individual-Data.xls;Extended Properties=Excel 8.0;";
When I click on the button, I got the following error:
The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.
I have no clue how to fix this. My operating system is Windows 7.
First verify which version of microsoft.ace.oledb.12.0 is installed in your system.
Check in below path C:\Program Files\Common Files\Microsoft Shared\OFFICE14\ACEOLEDB.DLL --64 bit is installed
Check in below path C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE14\ACEOLEDB.DLL --x86 bit is installed
If (x86) is installed then using configuration manager change solution platform to x86, for x64 change to x64.
If not available then install using below link
https://www.microsoft.com/en-us/download/details.aspx?id=23734
You need to change the Solution Platform from "Any CPU" to "x86" or "x64" based on the bitness of office installation.
The steps are given below:
Right click on the Solution File in Solution Explorer:
Click on the Active Platform Drop down, if x86 is already there then select that, else click on New.
Select x86 or x64 from the new platform dropdown:
Compile and run your application.
1.) Verify your connection string with ConnectionStrings.com.
2.) Make sure you have the correct database engine installed. These were the two database engines that helped me.
Microsoft Access Database Engine 2010 Redistributable
2007 Office System Driver: Data Connectivity Components
3.) There could be an issue with your build target platform being "Any CPU", it may need to be "X86" (Properties, Build, Platform Target).
If the installed "AccessDatabaseEngine" still does not help, below is solution:
You need to change the Active Solution Platform from "Any CPU" to "x86".
OLEDB Provider is Not Registered on the Local Machine
From CodeProject.com
I have similar issue when we are reading Excel file.
History of the problem:
We recently migrated our application from 32-bit to 64-bit because of the memory requirement. For that we migrated our windows 7 from 32-bit to 64-bit. But still we installed 32-bit office on our machines.
because, of this we had this issue while importing Excel data into application.
Solution,
I downloaded 64-bit version of the http://www.microsoft.com/en-us/download/details.aspx?id=13255 and installed with argument as,
AccessDatabaseEngine_x64.exe /passive
Without any code change my issue get resolved.
Note:
On 64-bit OS and 64-bit office, my functionality was working fine without this fix. This fix is only required while our application is 64-bit running on 64-bit OS which is having 32-bit office installed on it.