'Microsoft.ACE.OLEDB.12.0' provider is not

2018-12-31 02:48发布

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.

30条回答
后来的你喜欢了谁
2楼-- · 2018-12-31 03:21

If you're using 64-bit but still having problem even after installing AccessDatabaseEngine, see this post, it solved the problem for me.

i.e. You need to install this AccessDatabaseEngine

查看更多
路过你的时光
3楼-- · 2018-12-31 03:21

I was able to fix this by following the steps in this article: http://www.mikesdotnetting.com/article/280/solved-the-microsoft-ace-oledb-12-0-provider-is-not-registered-on-the-local-machine

The key point for me was this:

When debugging with IIS,

by default, Visual Studio uses the 32-bit version. You can change this from within Visual Studio by going to Tools » Options » Projects And Solutions » Web Projects » General, and choosing

"Use the 64 bit version of IIS Express for websites and projects"

After checking that option, then setting the platform target of my project back to "Any CPU" (i had set it to x86 somewhere in the troubleshooting process), i was able to overcome the error.

查看更多
唯独是你
4楼-- · 2018-12-31 03:22

A 64-bit version of the 'Microsoft Access Database Engine 2010 Redistributable' that will allow you to use the 'Microsoft.ACE.OLEDB.12.0' provider is available here:
http://www.microsoft.com/en-us/download/details.aspx?id=13255

If you use the download from the accepted answer, you will need to build for x86, as pointed out by @backtestbroker.com.

查看更多
闭嘴吧你
5楼-- · 2018-12-31 03:23

If you are debugging a web project, just make sure IIS Express is running either in 32 or 64 bits depending on your project settings.

Goto

Tools > Options > Projects and Solutions > Web Projects

and from there check (or uncheck) the 'Use 64 bit version of IIS Express...'

查看更多
查无此人
6楼-- · 2018-12-31 03:23

also can try these steps

In the SQL Server, 1.Open one data base 2.Clic in the option 'Server Obtect' 3.Clic in 'Linked Servers' 4.Clic in 'Providers' 5.Clic Rigth in 'Microsoft.ACE.OLEDB.12.0' 6.Uncheck all the options and close

查看更多
不再属于我。
7楼-- · 2018-12-31 03:24

depending on the app(32/64bit) using the connection you could just install

Summary:

  • all offices from 2007-2016 contain the provider "Microsoft.ACE.Oledb.12.0"
  • depending on your application architecture choose the appropriate runtime engine (32/64)
  • check your providers with the powershell-command from both 32 and 64bit shell:

    (New-Object system.data.oledb.oledbenumerator).GetElements() | select SOURCES_NAME, SOURCES_DESCRIPTION 
    
  • and you will see which provider your system can use

the long story: the strings can be found with http://live.sysinternals.com/strings.exe

eg. on a 64bit System with 32bit drivers installed

strings.exe -u -n 10 "c:\Program Files (x86)\Common Files\microsoft shared\OFFICE12\MSO.DLL" | findstr "ACE.O"
strings.exe -u -n 10 "c:\Program Files (x86)\Common Files\microsoft shared\OFFICE14\MSO.DLL" | findstr "ACE.O"
strings.exe -u -n 10 "c:\Program Files (x86)\Common Files\microsoft shared\OFFICE15\MSO.DLL" | findstr "ACE.O"

even in the upcoming office 2016

c:\Program Files\Microsoft Office\root\VFS\ProgramFilesCommonX64\Microsoft Shared\OFFICE16\MSO.DLL
c:\Program Files\Microsoft Office\root\VFS\ProgramFilesCommonX86\Microsoft Shared\OFFICE16\MSO.DLL

you will find the strings

  • Microsoft.ACE.OLEDB

  • Microsoft.ACE.Oledb.12.0

the Office 2013 comes also with csi.dll

c:\Program Files (x86)\Common Files\microsoft shared\OFFICE15\Csi.dll
c:\Program Files\Common Files\Microsoft Shared\OFFICE15\Csi.dll

which contains the "Microsoft.ACE.OLEDB.15.0"

and Office 2016

c:\Program Files\Microsoft Office\root\VFS\ProgramFilesCommonX64\Microsoft Shared\OFFICE16\Csi.dll
c:\Program Files\Microsoft Office\root\VFS\ProgramFilesCommonX86\Microsoft Shared\OFFICE16\Csi.dll

which has the "Microsoft.ACE.OLEDB.16.0" version

查看更多
登录 后发表回答