Error in Connect to the Access Database In Vb.net [duplicate] - vb.net

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?

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.

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.

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.

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 "<New...>".
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

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

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.

See my post on a similar Stack Exchange thread https://stackoverflow.com/a/21455677/1368849
I had version 15, not 12 installed, which I found out by running this PowerShell code...
(New-Object system.data.oledb.oledbenumerator).GetElements() | select SOURCES_NAME, SOURCES_DESCRIPTION
...which gave me this result (I've removed other data sources for brevity)...
SOURCES_NAME SOURCES_DESCRIPTION
------------ -------------------
Microsoft.ACE.OLEDB.15.0 Microsoft Office 15.0 Access Database Engine OLE DB Provider

I've got the same error on a fully updated Windows Vista Family 64bit with a .NET application that I've compiled to 32 bit only - the program is installed in the programx86 folder on 64 bit machines. It fails with this error message even with 2007 access database provider installed, with/wiothout the SP2 of the same installed, IIS installed and app pool set for 32bit app support... yes I've tried every solution everywhere and still no success.
I switched my app to ACE OLE DB.12.0 because JET4.0 was failing on 64bit machines - and it's no better :-/ The most promising thread I've found was this:
http://ellisweb.net/2010/01/connecting-to-excel-and-access-files-using-net-on-a-64-bit-server/
but when you try to install the 64 bit "2010 Office System Driver Beta: Data Connectivity Components" it tells you that you can't install the 64 bit version without uninstalling all 32bit office applications... and installing the 32 bit version of 2010 Office System Driver Beta: Data Connectivity Components doesn't solve the initial problem, even with "Microsoft.ACE.OLEDB.12.0" as provider instead of "Microsoft.ACE.OLEDB.14.0" which that page (and others) recommend.
My next attempt will be to follow this post:
The issue is due to the wrong flavor of OLEDB32.DLL and OLEDB32r.DLL being registered on the server. If the 64 bit versions are registered, they need to be unregistered, and then the 32 bit versions registered instead. To fix this, unregister the versions located in %Program Files%/Common Files/System/OLE DB. Then register the versions at the same path but in the %Program Files (x86)% directory.
Has anyone else had so much trouble with both JET4.0 and OLEDB ACE providers on 64 bit machines? Has anyone found a solution if none of the others work?

I am assuming that if you are running a 64 bit system with a 32 bit database and trying to run a 64 bit console, the following packages need to be installed on the machine.
Install the Microsoft Access Database Engine 2010 x86
Redistributable, this installation is available at:
http://www.microsoft.com/download/en/details.aspx?id=13255 .
Data Connectivity Components of Office 2007, this installation is
available at:
http://www.microsoft.com/download/en/confirmation.aspx?id=23734 .
Microsoft Access Database Engine 2010 x64 Redistributable. You will
need to download the package locally and run it with a passive flag.
You can download the installation here:
http://www.microsoft.com/en-us/download/details.aspx?id=13255
Installing using the command prompt with the '/passive' flag. In the
command prompt run the following command:
'AccessDatabaseEngine_x64.exe /passive'
Note: The order seems to matter - so if you have anything installed already, uninstall and follow the steps above.

Related

Unable to use Microsoft SQL Server [duplicate]

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.
Well, you need to install it. You're looking for:
The 2007 Office System Driver: Data Connectivity Components.
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.
depending on the app(32/64bit) using the connection you could just install
Access 2007 engines (only 32bit)
Access 2010 (32&64bit)
Access 2013 full runtime (32&64bit ! >200mb)
Access 2016 runtime
Access 2019 runtime
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)6
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
The first thing you need to check is your build configuration of your application.
If you have built your project under x86 platform, then in order to
resolve you issue you should install the following packages on your
machine:
In order to use the 'Microsoft.ACE.OLEDB.12.0' provider you must
install the Microsoft Access Database Engine 2010 Redistributable
first, this installation is available at:
http://www.microsoft.com/download/en/details.aspx?id=13255 .
After the installation has complete, try running you application, if this
solves the issue great, if not, continue to step 2.
This next step is an unexplained workaround, which works for Office
2010, even though it is the Data Connectivity Components of Office 2007. I am not quite sure why this works, but it does and this has been proven to work in almost all cases. You need to install the 2007 Office System Driver: Data Connectivity Components, this installation is available at:
http://www.microsoft.com/download/en/confirmation.aspx?id=23734 .
After this installation is complete, try running your application, this should resolve the issue.
If you are trying to run an application built under x64 or AnyCPU
platform, I would recommend first validating that it runs as expected
under the x86 platform. In the event that it does not run under that
x86 platform, perform the steps in the first part and validate that
it runs as expected.
I did read that the MS Access drivers including the OLEDB Database
driver works only under the x86 platform and is incompatible under
the x64 or AnyCPU platform. But this appears to be untrue. I
validated my application was running when building x86, then I
installed the Access Database Engine using the passive flag.
First download the file locally You can download the installation
here: http://www.microsoft.com/en-us/download/details.aspx?id=13255
Installing using the command prompt with the '/passive' flag. In
the command prompt run the following command:
'AccessDatabaseEngine_x64.exe /passive'
After these 2 steps I managed to run my application after building in
x64 or AnyCPU build configuration. This appeared to solve my issue.
Note: The order of the steps seems to make a difference, so please follow accordingly.
I got this error/exception in Visual Studio 2010 when I changed my build in the Configuration Manager dialog box from "x86" to "Any CPU". This OLEDB database driver I understand only works in x86 and is not 64bit compatible. Changing the build configuration back to x86 solved the problem for me.
I installed the MS drivers and it still didn't work for me. Then I found this blog post that solved the issue. Read it there, else use these two images (linked from that post) as the TLDR sumamary:
Although many answers have been given, the problem I encountered was not yet mentioned.
My Scenario: 64-Bit Application, Win10-64, Office 2007 32-Bit installed.
Installation of the 32-Bit Installer AccessDatabaseEngine.exe as downloaded from MS
reports success, but is NOT installed, as verified with the Powershell
Script of one of the postings above here.
Installation of the 64-Bit installer AccessDatabaseEngine_X64.exe reported a shocking error message:
The very simple solution has been found here on an Autodesk site.
Just add the parameter /passive to the commandline string, like this:
AccessDatabaseEngine_X64.exe /passive
Installation successful, the OleDb driver worked.
The Excel files I am processing with OleDb are of xlsx type, produced with EPPlus 4.5 and modified with Excel 2007.
For all those still affected by this.
I've been getting the error...
OLEDB error "The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine."
...as described by the OP, Shailesh Sahu.
I have 64bit Windows 7.
My problem is within PowerShell scripts, but is using a connection string, similar to the OP's post, so hopefully my findings can be applied to C#, PowerShell and any other language relying on the "Microsoft.ACE.OLEDB" driver.
I followed instructions on this MS forum thread: http://goo.gl/h73RmI
I first tried installing the 64bit version, then installing the 32bit version of the AccessDatabaseEngine.exe from this page
http://www.microsoft.com/en-us/download/details.aspx?id=13255
But still no joy.
I then ran the code below in PowerShell (from SQL Panda's site http://goo.gl/A3Hu96)
(New-Object system.data.oledb.oledbenumerator).GetElements() | select SOURCES_NAME, SOURCES_DESCRIPTION
...which gave me this result (I've removed other data sources for brevity)...
SOURCES_NAME SOURCES_DESCRIPTION
------------ -------------------
Microsoft.ACE.OLEDB.15.0 Microsoft Office 15.0 Access Database Engine OLE DB Provider
As you can see, I have Microsoft.ACE.OLEDB.15.0 (fifteen) not Microsoft.ACE.OLEDB.12.0 (twelve)
So, I amended my connection string to 15 and it worked.
So, a quick PowerShell snippet to demonstrate how to soft-code the version...
$AceVersion = ((New-Object System.Data.OleDb.OleDbEnumerator).GetElements() | Where-Object { $_.SOURCES_NAME -like "Microsoft.ACE.OLEDB*" } | Sort-Object SOURCES_NAME -Descending | Select-Object -First 1 SOURCES_NAME).SOURCES_NAME
$connString = "Provider=$AceVersion;Data Source=`"$filepath`";Extended Properties=`"Excel 12.0 Xml;HDR=NO`";"
amended to pick the latest ACE version, if more than one
Hopefully, anyone finding this can now check to see what OLEDB version is installed and use the appropriate version number.
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
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 Configuration Manager.
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.
do this 2 steps:
in this menu: project -> yourproject properties... -> Build : uncheck "prefer 32-Bit"
in connectionString : write cuotes before and after Extended properties, like this: Extended Properties='Excel 12.0 Xml;HDR=YES'
var fileName = string.Format("{0}", openFileDialog1.FileName);
var connectionString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0}; Extended Properties='Excel 12.0 Xml;HDR=YES'", fileName);
var adapter = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", connectionString);
var ds = new DataSet();
adapter.Fill(ds, TableNmae);
DataTable data = ds.Tables[TableNmae];
dg1.DataSource = data;
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.
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...'
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
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
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 using VS 2012 or later, make sure that "Prefer 32-bit" checkbox is unchecked in the project's Properties => Build => General configuration
syp_dino,
The solution for me as you suggested for the "Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine" error is to change the Active Solution Platform from "Any CPU" to "x86".
When I performed those steps, rebuilt the solution, grabbed the EXE and placed in on the network, everything worked smoothly on the Windows 7 64 bit machine.
I faced this same problem. Go to the Solution Properties and change Any CPU to x86, I think it will do the job.
These configurations worked in January of 2020 on my new machine build:
(1 - x64 only) Windows 10 x64, Office 365 x64, AccessDatabaseEngine_x64 2016 installed with /passive argument, VStudio build settings set to x64 explicitly, with the following connection string: Provider= Microsoft.ACE.OLEDB.16.0; Data Source=D:...\MyDatabase.accdb
(2 - x64 or x32) Windows 10 x64, Office 365 x64, AccessDatabaseEngine_x64 2016 installed with /passive argument, PLUS AccessDatabaseEngine 2010 (32bit) installed with /passive argument, VStudio build settings set to AnyCPU, with the following connection string: Provider= Microsoft.ACE.OLEDB.16.0; Data Source=D:...\MyDatabase.accdb
(3 - x32 only) Windows 10 x64, Office 365 x32, AccessDatabaseEngine 2010 (32bit) installed with /passive argument, VStudio build settings set to x86, with the following connection string: Provider= Microsoft.ACE.OLEDB.12.0; Data Source=D:...\MyDatabase.accdb
FAILURE NOTES
Using the ACE.OLEDB.12.0 x64 provider in the connection string failed with only the AccessDatabaseEngine_x64 2016 installed as above in (1).
Using AnyCPU in the visual studio build settings failed in (1). Setting x64 is required. Maybe this is because AnyCPU means that Vstudio must see an x32 ACE.OLEDB.nn.0 provider at compile time.
The ACE.OLEDB.12.0 2016 x32 /passive engine would NOT install when it saw x64 applications around. (The ACE.OLEDB.12.0 2010 x32 /passive installer worked.)
CONCLUSIONS
To use x64 build settings, you need to have the 2016 x64 database engine AND the ACE.OLEDB.16.0 connection-string provider AND explicit x64 build settings to work with Office 365 in January of 2020. Using the /passive option makes installations easy. Credit to whoever posted that tip!
To use AnyCPU, I needed to have both the ACE.OLEDB.12.0 2010 x32 engine and the ACE.OLEDB.16.0 x64 engines installed. That way Vstudio could see both x32 and x64 engines at "AnyCPU" compile time. I could change the provider connection string to ACE.OLEDB.12.0 for x32 operation or to ACE.OLEDB.16.0 for x64 operation. Both worked fine.
To use x86 build settings, you need to have the 2010 x32 database engine AND the ACE.OLEDB.12.0 connection-string provider AND explicit x86 build settings to work with Office 365 x32 in January of 2020.
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.
I had this issue when attempting to import data from an excel file (xlsx) into a SQL Server DB using SSMS 2014.
The 2007 Office System Driver: Data Connectivity Components install did the trick for me.
I received this error when importing data from an Excel file into MS-SQL.
The provider was already installed (64-bit) and this surprised me why it didn't work.
So all I did was locate the Import/Export application used here i.e. the .EXE.
And I found it at
C:\Program Files\Microsoft SQL Server\130\DTS\Binn\DTSWizard.exe
I then ran the .exe directly to perform the data import. And it worked!
I followed the instructions set out by others; installing this patch, installing that patch as well as the Microsoft Access Database Engine 2010.
My issue was that I'm using the same library (linq2sql) in 2 sites on my machine; 1 works and 1 doesn't.
Eventually I found that I had to "enable 32 bit applications" in the advanced settings of the apppool for my non-working site.
Everything works fine now.
Just download & install the following Access DB engine (X86 or X64: as per your machine configuration) and see the magic :)
https://www.microsoft.com/en-us/download/confirmation.aspx?id=13255
If you get this error when trying to use ACE from an ASP.NET application, the most likely cause is that you have installed either one of the 32-bit versions. By default, IIS on a 64-bit operating system will run applications in a 64-bit worker process. 64-bit processes cannot load 32-bit DLLs. When a call is made to the ACE provider, the 64 bit process will attempt to locate a 64-bit DLL. If it doesn't exist, you get the error message that brought you here.
In this case you have two options. First, you can install the 2010 64-bit version. If you have the 2007 32-bit version installed, you can simply install the 2010 64-bit version alongside it. If you have the 32-bit version of 2010 installed, you need to uninstall it and download and install the 64-bit 2010 version instead. You cannot have both the 32- and 64-bit versions of the 2010 provider installed at the same time. If you are performing the installation on your development machine, you may also be constrained by the bit-ness of any existing Office installations.
The second option is to change the application pool in IIS to enable 32-bit applications. If you are using the full version of IIS, you can use the management tool to do this (Control Panel » Administrative Tools » Internet Information Services (IIS) Manager).
For more understanding please refer below link
for Visual Studio 2022 (and newer)
I had this error every time and it didn't help anything. VS2019 was the solution.
https://learn.microsoft.com/en-us/visualstudio/data-tools/accessing-data-in-visual-studio?view=vs-2022#data-providers
If you're using Visual Studio 2022 to connect to databases, you will
need to be aware that Visual Studio 2022 is a 64-bit process. This
means some of the data tools in Visual Studio will not be able to
connect to OLEDB or ODBC databases using 32-bit data providers.
If you need to maintain 32-bit applications that connect to OLEDB or
ODBC databases, you will still be able to build and run the
application with Visual Studio 2022. However, if you need to use any
of the Visual Studio Data Tools such as Server Explorer, Data Source
Wizard, or the DataSet Designer, you will need to use an earlier
version of Visual Studio that is still a 32-bit process. The last
version of Visual Studio that was a 32-bit process was Visual Studio
2019.
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
I had the same issue but in this case microsoft-ace-oledb-12-0-provider was already installed on my machine and working fine for other application developed.
The difference between those application and the one with I had the problem was the Old Applications were running on "Local IIS" whereas the one with error was on "IIS Express(running from Visual Studio").
So what I did was-
Right Click on Project Name.
Go to Properties
Go to Web Tab on the right.
Under Servers select Local IIS and click on Create Virtual Directory button.
Run the application again and it worked.
I had Microsoft Access Database Engine 2010 Redistributable already installed on my machine but was still receiving the Microsoft ACE OLEDB Provider error.
Then I recalled that I had upgraded to Office 2016 recently, so, may be I should try reinstalling Microsoft Access Database Engine 2010 Redistributable. And that fixed the problem on my machine.
So, if you have upgraded to different version of MS Office or even repaired/reinstalled your MS Office then try reinstalling Microsoft Access Database Engine 2010 Redistributable before wasting time with finding other fixes. Good luck!
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).

How to install CR10 runtime on win7 64bit

I'm using the Crystal Report 10 viewer ActiveX control in an Access App I've written. Works great in Office 2003 on 32bit versions of Windows. The problem arrises when I try to run the program in 64 bit Windows (with 32bit Office). I get the following error:
Run-time error '429': ActiveX component can't create object
I get this error on the following line of my VBA code.
Set rdApp = CreateObject("Crystalruntime.application.10")
How can I get this to work in 64bit?
I don't have any specific experience with Crystal Report, but I do have some experience with installing components on a 64-bit Windows environment that were intended for 32-bit Windows, so here are some general suggestions of things to try:
Before installing, try loosening the security privileges - I have Windows Server 2008; on this OS, they're under Start | Administrative Tools | Local Security Policy. Many old installers are thwarted by these controls. You'll want to return them to their defaults after the install.
Make sure that you run the installer with admin privileges (right-click; run as Administrator).
Examine the installation log for Crystal Report - it may indicate a failure registering a component. In one instance, I was able to get the installation working by running the command to register the failed component manually, on an administrator-privileged command line (the command was in the log).
If acceptable, try to create a Windows Virtual Machine running a virtual Windows XP, and try the installations there (this might be a bit tedious, due to your need for MS Office).
Take a look at VMWare's ThinApp - this is intended for packaging applications for administrators, but this was the solution we ended up using to shield one of our 32-bit apps from Windows 64-bit perils
Hope this helps; we struggled for awhile trying different things to get our legacy apps working on a 64-bit environment.

If I compile a VB6 app on win7, ADODB.Connection errors with "Class does not support Automation or does not support expected interface"

I compiled some VB6 code on my Win7 x64 machine and the result .exe will not run correctly on any other machine.
VB6 code is just a new template .exe file with one button, a reference to "Microsoft ActiveX Data Objects 2.6 Library" and the following code in the button press event:
Dim db
Set db = New ADODB.Connection
It runs correctly on my machine, but no others (even other Win7 x64 machines) (Update: I found TWO other users where it runs and one of them is Jeff Atwood!, but most machines have the same problem)
I checked the references screen on both machines to see if a reference failed (it wouldn't compile then though and it compiles fine). Everything looks legit. On the 64 bit machines, the references go into SysWow64 instead of system32.
I've even compiled this successfully on a Vista 64 bit machine and had it run correctly. It's only the compile on the Windows 7 and then running on any other machine where the error happens.
Here are the results of running CompChecker on my box:
Registry info: ADODB.Connection has GUID HKEY_CLASSES_ROOT\CLSID{00000514-0000-0010-8000-00AA006D2EA4}
InprocServer32 is %CommonProgramFiles%\System\ado\msado15.dll
This is a Windows 7 SP1 issue. See http://support.microsoft.com/kb/2517589 for workarounds.
There are other ways around this:
Use ADO 2.8 instead (from Win 7 RTM
disk)
Use late-binding (probably the
easiest)
There are a million things that
people are trying on this very long
and angry thread: Breaking change in MDAC ADODB COM components in Windows 7 Service Pack 1
Also, another thing, msado15.dll is not supported on x64 Win 7 as listed here: http://support.microsoft.com/kb/983246. It's a big page, just search on msado15.dll.
Check out the version of the MDAC components in both machines using this tool
Also be sure that you are using the same SQL Server (guessing) version database, since I've noticed that SQL Server 2008 x64 works differents than previous versions handling connections (when using VB6)

How do I resolve "Run-time error '429': ActiveX component can't create object"?

My company has a VB6 application using Crystal Reports 7 which a client has asked to be installed on Windows 7 32 bit. It is currently installed on Windows XP 32bit SP2 machines at the client. Connection to the DB is done via ODBC to SQL Server 2000 instance on another server.
On Windows 7, the installation works fine, however when you try to open the application, the error is given.
I have looked at the following:
Registering all the dll's and ocx files using regsvr32. Some will not register as they either are registered already or the following message is given "Make sure that "[name].dll" is valid DLL or OCX file and then try again." I read this forum thread regarding this: http://social.msdn.microsoft.com/forums/en-US/vblanguage/thread/0653f685-4526-45d9-89f3-8c479a6b4c62
Monitored the opening of the application using a ProcessMonitor application to try and spot if there is a missing dll or ocx file - this does not seem to be the case.
Reviewed the application according to this list and nothing seems to be against these guidelines
I've noticed two items in the knowledge base that relate to this
http://support.microsoft.com/kb/281848 - the comdlg32.ocx bundled with the application is version 6.0.81.69 and the one in the system32 folder on the dev machine (WinXP 32 bit) is 6.1.97.82. However if this was the issue then surely it would not work currently?
http://support.microsoft.com/kb/184898 - I'm not sure how to confirm that this is the issue
Finally, due to complexities, I am not allowed to make code changes to this application. Even if I was, I'm not a VB6 programmer, just the guy who got the terribly support project! If code changes are required, then I'll have to investigate using WinXP mode.
Update: I get the same error in XP Mode. That's a Win XP with SP3 VM. This runs on a Win XP SP2 VM, is there potentially something in SP3 that would have caused this to occur? Or is it just a fact of it being XP Mode?
I got the same error but I solved by using regsvr32.exe in C:\Windows\SysWOW64.
Because we use x64 system. So if your machine is also x64, the ocx/dll must registered also with regsvr32 x64 version
The file msrdo20.dll is missing from the installation.
According to the Support Statement for Visual Basic 6.0 on Windows Vista, Windows Server 2008 and Windows 7 this file should be distributed with the application.
I'm not sure why it isn't, but my solution is to place the file somewhere on the machine, and register it using regsvr32 in the command line, eg:
regsvr32 c:\windows\system32\msrdo20.dll
In an ideal world you would package this up with the redistributable.
This download fixed my VB6 EXE and Access 2016 (using ACEDAO.DLL) run-time error 429. Took me 2 long days to get it resolved because there are so many causes of 429.
http://www.microsoft.com/en-ca/download/details.aspx?id=13255
QUOTE from link:
"This download will install a set of components that can be used to facilitate transfer of data between 2010 Microsoft Office System files and non-Microsoft Office applications"
You say it works once you install the VB6 IDE so the problem is likely to be that the components you are trying to use depend on the VB6 runtime being installed.
The VB6 runtime isn't installed on Windows by default.
Installing the IDE is one way to get the runtime. For non-developer machines, a "redistributable" installer package from Microsoft should be used instead.
Here is one VB6 runtime installer from Microsoft. I'm not sure if it will be the right version for your components:
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=7b9ba261-7a9c-43e7-9117-f673077ffb3c

Microsoft Access Database Engine - Failure Creating File

I've installed the Microsoft Access Database Engine in order for an app to read and update and Excel file using OLEDB on a 64bit operating system. It all still works fine on 32 bit however i get a "Failure Creating File" error on a 64 bit machine.
I'm using the following connectionstring(VB.Net) as per connectionstrings.com(http://www.connectionstrings.com/excel-2007):
lstrConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\temp\excelfile.xlsx;Extended Properties=""Excel 12.0;HDR=YES"";"
Any advice would be greatly appreciated. Thanks a lot!
You'll need to install the 64-bit version. Download from here.
The generic solution is to force your program to run in 32-bit mode. Project + Properties, Compile tab, scroll down, Advanced Compile Options, Target CPU = x86.