0

I have 32-bit Office installed together with 32-bit AccessDatabaseEngine on a laptop with 64-bit Windows 10.

With 32-bit Office goes 32-bit ACE although Office does not use ACE (but VBA can do) and (Microsoft disallows 32- 64-bit ACE 12.0 to coexist on the same computer).

Using an identical connection string and sql statement, I am able to use ADODB successfully but a C# COM server is giving me this error:

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

I am also able to Import Data from xlsx sources in SQL Server Management Studio.

It appears that the C# Com server is looking for the 64-bit version. I have specified x86 as the target platform for the C# project.

Any hints on how to overcome the error with the C# COM server? Why does C# default to using 64-bit ACE 12.0 (ADODB & SSMS do not)? Is there a way of coercing the use of 32-bit ACE in the C# project - I've already specified x86 as the target platform?

Thanks.

Johnny Willemsen
  • 2,942
  • 1
  • 14
  • 16
AAsk
  • 1,431
  • 4
  • 17
  • 25
  • Possible duplicate of [Microsoft.ACE.OLEDB.12.0 Provider can no longer open .mdb under Windows 8](https://stackoverflow.com/questions/14562587/microsoft-ace-oledb-12-0-provider-can-no-longer-open-mdb-under-windows-8) – Ken White Jul 10 '19 at 00:29
  • Not a duplicate question nor one that has been answered. On the same laptop, I have a situation where ADODB works, SSMS works but C# does NOT work. I am looking for a way to resolve the issue with C#. – AAsk Jul 10 '19 at 05:19
  • Office itself doesn't use Microsoft.ACE.OLEDB.12.0 so it's not a proof of anything. Not sure SQL Server uses it either. The error is caused by one thing: the Access Provider is not installed in the registry that the program is compiled for. Are you sure some part of your program doesn't run as x64. Your .exe probably don't run as x86 for some reason. Just try a simple C# console app as x86 first and then proceed to COM issues. Or use Procmon tool from sysinternals to see what part of the registry are used. Also check https://stackoverflow.com/a/32247214/403671 – Simon Mourier Jul 10 '19 at 06:41
  • It **has** been answered. There are multiple answers, one of which that has been accepted and upvoted 16 times. Did you bother to read it? – Ken White Jul 10 '19 at 12:11
  • You are wrong and your response adds NOTHING to solving the problem to hand. – AAsk Jul 10 '19 at 14:52
  • I compiled my COM code using CSC.EXE and got this: *warning CS8012: Referenced assembly 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' targets a different processor*. The same code without COM attributes built as a console application works – AAsk Jul 11 '19 at 09:45

0 Answers0