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

  • Question

  • User-304920254 posted

    Hello,

         I am trying to copy data from excel sheet to sql server using sql bulk copy all logic working fine on IIS Express. But whenever I  have hosted it on IIS and ran it throws this error "Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine". So please help to resolve this without setting in Application pool "Enable 32-Bit Application = true" because I don't want to set it true. I have used MS Office 32-Bit, It have to uninstall or any solution with it. Get error on "excel_con.Open()"

     'Upload and save the file
                Dim excelPath As String = Server.MapPath("~/Files/") + Path.GetFileName(FileUpload1.PostedFile.FileName)
                FileUpload1.SaveAs(excelPath)
    
                Dim connString As String = String.Empty
                Dim extension As String = Path.GetExtension(FileUpload1.PostedFile.FileName)
    
                Select Case extension
                    Case ".xls"
                        'Excel 97-03
                        connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & excelPath & ";Extended Properties=""Excel 8.0;HDR=YES;IMEX=1"""
                        Exit Select
                    Case ".xlsx"
                        'Excel 07 or higher
    
                        connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & excelPath & ";Extended Properties=""Excel 12.0 Xml;HDR=YES;IMEX=1"""
                        Exit Select
                End Select
    
    
    
                Using excel_con As New OleDbConnection(connString)
                    excel_con.Open()
                    Dim sheet1 As String = excel_con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, Nothing).Rows(0)("TABLE_NAME").ToString()
                    Dim dtExcelData As New DataTable()

    Tuesday, April 11, 2017 12:01 PM

All replies