I'm developing a Windows Form application which connects to a Microsoft Access database.
This is a sample code that I use in the development:
string AccessFilePath = @"\.myDataBase.mdb"; // Path of the Access database.
string sqlStatement = "SELECT * FROM myTable WHERE IdTable = 5;";
string connstr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + AccessFilePath;
OleDbConnection conn = new OleDbConnection(connstr);
OleDbCommand cmd = new OleDbCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = sqlStatement;
cmd.Connection = conn;
catch (Exception ex)
MessageBox("Error: " + ex.Message);
- C:\Program Files (x86)\Microsoft Office\root\VFS\ProgramFilesCommonX86\Microsoft Shared\OFFICE16
- C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE15
- C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE14
- C:\Program Files (x86)\Microsoft Office\root\VFS\ProgramFilesCommonX86\Microsoft Shared
"The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine"
After change the Platform Target to x86 as user LarsTech suggested in his comment, in the end user machines which has Windows 7 OS and no Office suite installed. It worked correctly.
I though that this change would be enough, but, for some unknown reason, in my PC, that wasn't.
So, I have to research again and I found a similar problem here.
The workaround in this particular situation is install:
In my case, the following ACEOLEDB.DLL entries were created:
- C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE12 - C:\Windows\Installer\$PatchCache$\Managed\00004109C10000000000000000F01FEC\14.0.4763
I think that the last entry was created by the 2010 Runtime installation.