locked
The provider 'Microsoft.ACE.OLEDB.12.0' is not registered on the local machine RRS feed

  • Question

  • User662762443 posted

    I have the following problem, when I run my application, it returns the error of the office access provider, I think it's something like this. However, I joined in other topics related to this problem, I followed some suggestions to change the configuration of my solution in configuration Menager and I was in Active solution platform I put the option of X86 in in Project in the PlatFrom tab I also changed to x64, however, it also did not work when compiling.

    Remember that I also installed the drive to try to fix the problem, it also did not work. Here's my code:

    private DataTable DadosExcel(string caminho)
            {
                Char aspas = '"';
    
                //OleDbConnection connection = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source="" + caminho + "";Extended Properties='Excel 12.0;HDR=No;IMEX=1';");
                string Connection = "Provider=Microsoft.ACE.OLEDB.12.0;" +
                "Data Source=" + way + ";" +
                "Extended Properties=" + quotation marks + "Excel 12.0;HDR=No;IMEX=1" + quotation marks;
                System.Data.OleDb.OleDbConnection Cn = new System.Data.OleDb.OleDbConnection();
                Cn.ConnectionString = Connection;
                Cn.Open();
                object[] Restrictions = { null, null, null, "TABLE" };
                DataTable DTSchema = Cn.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables, Restrictions);
                if (DTSchema.Rows.Count > 0)
                {
                    string Sheet = DTSchema.Rows[0]["TABLE_NAME"].ToString();
                    OleDbCommand Command = new OleDbCommand("SELECT * FROM [" + Sheet + "]", Cn);
                    DataTable Data = new DataTable();
                    System.Data.OleDb.OleDbDataAdapter DA = new System.Data.OleDb.OleDbDataAdapter(Command);
                    DA.Fill(Data);
                    Cn.Close();
                    return Data;
                }
                return null;
            }

    I use the code for Excel 2007 worksheet data

    Error:

    ($exception).StackTrace

    em System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper)
    em System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
    em System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
    em System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
    em System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
    em System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
    em System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
    em System.Data.OleDb.OleDbConnection.Open()
    em SDPJView.ImportacaoProcessoView.ImportacaoProcesso.DadosExcel(String caminho) na D:\Repositório SVN\SDP\SDPJ\branches\SDPJ-V3.1.0\SDPJ-102\SDPJView\ImportacaoProcessoView\ImportacaoProcesso.aspx.cs:linha 729
    em SDPJView.ImportacaoProcessoView.ImportacaoProcesso.importar_Click(Object sender, EventArgs e) na D:\Repositório SVN\SDP\SDPJ\branches\SDPJ-V3.1.0\SDPJ-102\SDPJView\ImportacaoProcessoView\ImportacaoProcesso.aspx.cs:linha 88
    em System.Web.UI.WebControls.Button.OnClick(EventArgs e)
    em System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
    em System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


    Does anyone kindly have any idea what can be done?

    Tuesday, June 19, 2018 1:25 PM

Answers

  • User-330142929 posted

    Hi RtaVix,

    According to your description, I think you have installed the driver correctly. But considering the issue of AccessDatabaseEngine version, here I post some other links you may need to download.

    AccessDatabaseEngine2016

    https://www.microsoft.com/en-us/download/details.aspx?id=54920

    AccessDatabaseEngine2010

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

    AccessDatabaseEngine2007

    https://www.microsoft.com/en-us/download/details.aspx?id=23734

    In addition, I suggest you could try to configure the following options.

    First right click the project in Visual studio and modify the target platform to x86, and then in the corresponding IIS application pool, set Application Pool Default properties, Right-click/Advanced Settings/Enable 32-bit application, set to true.

    If you want to deploy the project to IIS, I suggest you could use Office64bit(access) to develop the program. this will avoid the difference between the local compilation environment and IIS environment . 

    If the solution could not solve your problem, please feel free to let me know.

    Best Regards,

    Abraham

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, June 20, 2018 7:58 AM

All replies