现在的位置: 首页 > 综合 > 正文

Microsoft.ACE.OLEDB.12.0 provider is not registered (zz)

2013年01月19日 ⁄ 综合 ⁄ 共 7773字 ⁄ 字号 评论关闭

//z 2012-08-13 17:45:07 IS2120@CSDN.T3388923946[T90,L1428,R36,V860] Q1
I have a Visual Studio 2008 solution with two projects (a Word-Template project and a VB.Net console application for testing). Both projects reference a database project which opens a connection to an MS-Access 2007 database file and have references to System.Data.OleDb.
In the database project I have a function which retrieves a data table as follows

 private class AdminDatabase
   ' stores the connection string which is set in the New() method
   dim strAdminConnection as string

   public sub New()
   ...
   adminName = dlgopen.FileName
   conAdminDB = New OleDbConnection
   conAdminDB.ConnectionString = "Data Source='" + adminName + "';" + _
       "Provider=Microsoft.ACE.OLEDB.12.0"

   ' store the connection string in strAdminConnection
   strAdminConnection = conAdminDB.ConnectionString.ToString()
   My.Settings.SetUserOverride("AdminConnectionString", strAdminConnection)
   ...
   End Sub

   ' retrieves data from the database
   Public Function getDataTable(ByVal sqlStatement As String) As DataTable
        Dim ds As New DataSet
        Dim dt As New DataTable
        Dim da As New OleDbDataAdapter
        Dim localCon As New OleDbConnection


        localCon.ConnectionString = strAdminConnection

        Using localCon
            Dim command As OleDbCommand = localCon.CreateCommand()
            command.CommandText = sqlStatement
            localCon.Open()
            da.SelectCommand = command
            da.Fill(dt)
            getDataTable = dt
        End Using

    End Function
End Class

When I call this function from my Word 2007 Template project everything works fine; no errors. But when I run it from the console application it throws the following exception

ex = {"The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine."}

Both projects have the same reference and the console application did work when I first wrote it (a while ago) but now it has stopped work. I must be missing something but I don't know what. Any ideas?

//z 2012-08-13 17:45:07 IS2120@CSDN.T3388923946[T90,L1428,R36,V860] A1
I have a visual Basic program with Visual Studio 2008 that uses an Access 2007 database and was receiving the same error. I found some threads that advised changing the advanced compile configuration to x86 found in the programs properties if you're running
a 64 bit system. So far I haven't had any problems with my program since.

//z 2012-08-13 17:45:07 IS2120@CSDN.T3388923946[T90,L1428,R36,V860] A2

Basically, if you're on a 64-bit machine, IIS 7 is not (by default) serving 32-bit apps, which the database engine operates on. So here is exactly what you do:

1) ensure that the 2007 database engine is installed, this can be downloaded at:http://www.microsoft.com/downloads/details.aspx?FamilyID=7554F536-8C28-4598-9B72-EF94E038C891&displaylang=en

2) open IIS7 manager, and open the Application Pools area. On the right sidebar, you will see an option that says "Set application pool defaults". Click it, and a window will pop up with the options.

3) the second field down, which says 'Enable 32-bit applications' is probably set to FALSE by default. Simply click where it says 'false' to change it to 'true'.

4) Restart your app pool (you can do this by hitting RECYCLE instead of STOP then START, which will also work).

5) done, and your error message will go away.

-Matt

//z 2012-08-13 17:45:07 IS2120@CSDN.T3388923946[T90,L1428,R36,V860] A3

Are you running a 64 bit system with the database running 32 bit but the console running 64 bit? There are no MS Access drivers that run 64 bit and would report an error identical to the one your reported.

>>>

 
Yes, I am running 64bit XP and this was exactly the problem. Switched the target CPU in Advanced Compile Options to x86 bit application and all works now. Thanks

//z 2012-08-13 17:45:07 IS2120@CSDN.T3388923946[T90,L1428,R36,V860] A4

Solution:

That's it! Thanks Arjun Paudel for the link. Here's the solution as found on XNA Creator's Club Online. It's by Stephen Styrchak.

The following error suggests me to believe that you are compiling for 64bit:

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

I dont have express edition but are following steps valid in 2008 express?

http://forums.xna.com/forums/t/4377.aspx#22601

http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/ed374d4f-5677-41cb-bfe0-198e68810805/?prof=required
- Arjun Paudel


In VC# Express, this property is missing, but you can still create an x86 configuration if you know where to look.

It looks like a long list of steps, but once you know where these things are it's a lot easier. Anyone who only has VC# Express will probably find this useful. Once you know about Configuration Manager, it'll be much more intuitive the next time.

1.In VC# Express 2005, go to Tools -> Options.2.In the bottom-left corner of the Options dialog, check the box that says, "Show all settings".3.In the tree-view on the left hand side, select "Projects and Solutions".4.In the options on the right, check the
box that says, "Show advanced build configuraions."5.Click OK.6.Go to Build -> Configuration Manager...7.In the Platform column next to your project, click the combobox and select "".8.In the "New platform" setting, choose "x86".9.Click OK.10.Click Close.There,
now you have an x86 configuration! Easy as pie! :-)

I also recommend using Configuration Manager to delete the Any CPU platform. You really don't want that if you ever have depedencies on 32-bit native DLLs (even indirect dependencies).

Stephen Styrchak | XNA Game Studio Developer

http://forums.xna.com/forums/p/4377/22601.aspx#22601

//z 2012-08-13 17:45:07 IS2120@CSDN.T3388923946[T90,L1428,R36,V860] A5

I thought I'd chime in because I found this question when facing a slightly different context of the problem and thought it might help other tormented souls in the future:

I had an ASP.NET app hosted on IIS 7.0 running on Windows Server 2008 64-bit.

Since IIS is in control of the process bitness, the solution in my case was to set the Enable32bitAppOnWin64 setting to true:http://blogs.msdn.com/vijaysk/archive/2009/03/06/iis-7-tip-2-you-can-now-run-32-bit-and-64-bit-applications-on-the-same-server.aspx

It works slightly differently in IIS 6.0 (You cannot set Enable32bitAppOnWin64 at application-pool level)http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/0aafb9a0-1b1c-4a39-ac9a-994adc902485.mspx?mfr=true

//z 2012-08-13 17:45:07 IS2120@CSDN.T3388923946[T90,L1428,R36,V860] A6

I'm having same problem. I try to install office 2010 64bit on windows 7 64 bit and then install 2007 Office System Driver : Data Connectivity Components.

after that, visual studio 2008 can opens a connection to an MS-Access 2007 database file.

//z 2012-08-13 17:45:07 IS2120@CSDN.T3388923946[T90,L1428,R36,V860] A7

NOTE: i have found hundreds of threads on this error, yet they all seem to suggest using the 'Microsoft access database engine'. however for whatever reason (even though its made for 64-bit office) this did not work on my machine so i was forced
to find an alternate method.

this resolution works with:

  • 64-bit Windows 7
  • 64-bit MS Office
  • Please reply to this thread if it worked for you so i can make this a full "compatibility list"

 

trying to connect to an Access database in visual studio but keep getting this error?

try installing this first: http://www.microsoft.com/download/en/details.aspx?id=13255

 

however if, like me, that doesnt work for you, try the following method:

NOTE: this DOES work for office 2010 even though it is for 2007 office, dont ask me why it just does :)

1. download and install this: http://www.microsoft.com/download/en/confirmation.aspx?id=23734

2. in VS click add data source, follow the wizard and enjoy! :)

 

P.S thanks to everyone that helped me at my original thread: http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/ebb05600-055a-44c4-8cd3-d33a79878b23

i did give up and tried storing to text files, but oh my god was that a bad choice! so i came back to trying to resolve this and managed to after HOURS AND HOURS of searching.

this thread is for all of those people being given a hard time connecting to Access databases!

Please share your opinions/ problems below!

//z 2012-08-13 17:45:07 IS2120@CSDN.T3388923946[T90,L1428,R36,V860] Q2

The Microsoft.ACE.OLEDB.14.0 provider is not registered on the local machine.

Hi moosey,

For OleDb connection and Office 2010, we still use "Microsoft.ACE.OLEDB.12.0" instead of "Microsoft.ACE.OLEDB.14.0".   The document of Office 2010 data driver betas
is incorrect,

https://connect.microsoft.com/data/feedback/details/541090/access-database-engine-2010-installation-issue-to-use-with-ado-access-technology-to-access-data-from-jet-database-mdb-files?wa=wsignin1.0.  

Also, from Office 2010 data driver download page, the content issue is fixed,http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=c06b8369-60dd-4b64-a44b-84b371ede16d

Have a nice day!

Best Regards,
Lingzhi Sun

MSDN Subscriber Supportin
Forum

If you have any feedback on our support, please contactmsdnmg@microsoft.com

抱歉!评论已关闭.