Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No solution for 'Microsoft.ACE.OLEDB.12.0' error

Tags:

c#

asp.net-mvc

I have a problem with an MVC C# application in one controller.

The following code continues to give the error:

 *The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.*

The code below:

var excel = new ExcelQueryFactory("~/App_Data/uploads/" + tempName);
var usersForImport = from c in excel.Worksheet<User>()
                        select c;
int count = usersForImport.Count();

for (int i = 0; i < count; i++)
{
    User user = new User();
    user = usersForImport.Skip(i).First();
    db.Users.Add(user);
    db.SaveChanges();
}

I have tried 2 solutions from previous posts, as I thought this problem was identical, but they do not solve the problem.

The two solutions I have tried are to install the Microsoft Access Database Engine or set the target platform for x86.

The code relies on 'linqtoexcel' package.

Has anyone else run into these problems? Any solutions?

like image 266
NickP Avatar asked Sep 13 '26 06:09

NickP


1 Answers

For 64-bit apps, there are two versions of the ACE driver available:

http://www.microsoft.com/en-us/download/details.aspx?id=23734 for Office 2007

http://www.microsoft.com/en-us/download/details.aspx?id=13255 for Office 2010

I believe the Office 2007 version has the ProgId 'Microsoft.ACE.OLEDB.12.0', so I would try this one rather than Office 2010, which I believe has the ProgId 'Microsoft.ACE.OLEDB.14.0'.

From your description, it looks like the linqtoexcel package might depend on the Office 2007 version.

like image 50
Joe Avatar answered Sep 14 '26 21:09

Joe