Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello friends,

While reading the .xlsx file I'm getting the The 'Microsoft.ACE.Oledb.12.0' provider is not registered on the local machine. exception.

Though I have installed AccessDatabaseEngine_x64. Download from http://www.microsoft.com/en-us/download/details.aspx?id=13255
I'm trying to read and write both .xls and .xlsx files.

I tried to use gacutil.exe to put it dll to my local but couldn't succeed.

My conncetion strings are
if (extn.ToUpper() == ".XLS")
            {
                excelConn = @"Provider=Microsoft.Jet.Oledb.4.0; Data Source=" + path + "; Extended Properties=Excel 8.0;";
            }
            if (extn.ToUpper() == ".XLSX")
            {
                excelConn = @"Provider=Microsoft.ACE.Oledb.12.0; Data Source=" + path + "; Extended Properties=Excel 12.0;";
            }


Please put some light on this context and guide me.
Thanks :)
Posted

1 solution

You can try this OLEDB Provider is not registered on the local machine[^]

OR

try adding the Reference of 'Microsoft.ACE.Oledb.12.0.dll' to your project.
 
Share this answer
 
Comments
Manish Kumar Namdev 31-Oct-12 2:11am    
Hello Bitla Phanindra Is there any way to work with both .xls and .xlsx file operation with c#. I'm using express edition 2010
Saroj Singh 28-Apr-14 7:23am    
Please anyone answer this....
Bitla Phanindra 23-Jun-14 11:35am    
Check my comment below..
All Time Programming 1-Feb-14 3:15am    
I tried forcing to compile using x86 platform only, but that didn't worked for me. Finally I tried installing the Driver from http://www.microsoft.com/en-us/download/confirmation.aspx?id=23734# and that made my app running back to normal.
Bitla Phanindra 23-Jun-14 11:34am    
You can try it this way..
if (FilePath.Trim().EndsWith(".xlsx"))
{
strConn = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 12.0 Xml;HDR=YES;IMEX=1\";", FilePath);
}
else if (FilePath.Trim().EndsWith(".xls"))
{
strConn = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\";", FilePath);
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900