Issue to ACE.OLEDB

Peter_1985 2,686 Reputation points
2021-05-17T19:34:51.47+00:00

Hi,
For issue below

[InvalidOperationException: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.]

Is this a version issue and server machine must be with 32-bit version of Microsoft.ACE.OLEDB.12.0?

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,012 questions
Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
881 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Ken Tucker 5,856 Reputation points
    2021-05-18T00:29:48.34+00:00

    The error is saying it does not have the Microsoft.Ace.OLEDB.12 drivers installed. If you have a 64bit computer you need to install the 64-bit version of Microsoft.Ace.OLEDB.12. It will install the 32 bit version also.

    https://www.microsoft.com/en-US/download/details.aspx?id=13255

    0 comments No comments

  2. Peter_1985 2,686 Reputation points
    2021-05-18T02:39:56.047+00:00

    Hi,
    I've set up 32 bit version (of ACE.OLEDB) but there is still error below

    [InvalidOperationException: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.]
    System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper) +258
    System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +497
    System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +100
    System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions) +57
    System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +1142 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) +312
    System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +23
    System.Data.OleDb.OleDbConnection.Open() +52

    0 comments No comments

  3. Timon Yang-MSFT 9,591 Reputation points
    2021-05-18T02:59:36.807+00:00

    Also pay attention to the version of your application, 64-bit applications cannot use 32-bit Microsoft.ACE.OLEDB.12.0.

    The default application created by Visual Studio is Any CPU but 32-bit is preferred. If you download a 64-bit OLEDB, you need to modify your application to X64, and vice versa.

    97381-1.png


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  4. Peter_1985 2,686 Reputation points
    2021-05-18T05:36:31.28+00:00

    Hi,
    I've changed Platform target to be X86 and have re-compiled project but then I've got issues below:

    WRN: Assembly binding logging is turned OFF.
    To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
    Note: There is some performance penalty associated with assembly bind failure logging.
    To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

    Stack Trace:

    [BadImageFormatException: Could not load file or assembly 'RegRec2' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
    System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
    System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +225
    System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +110
    System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +22
    System.Reflection.Assembly.Load(String assemblyString) +34
    System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +48


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.