Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I HAVE 64 BIT OS AND 2005 .NET APPLICATION

SO I WANT TO UPLOAD EXCEL FILE AND SAVE INTO DATA BASE , MY EXCEL VERSION IS 2016
AND
Interop.Microsoft.Office.Interop.Excel FILE VERSION -1.6.0.0


ERROR : Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154

ERROR IN BELOW CODE
Dim xlApp As Excel.Application

xlApp = New Excel.ApplicationClass

What I have tried:

If FileUpload1.HasFile Then


            Dim xlApp As Excel.Application
        

            txtRecivedDate.Text = Date.Now.ToString("ddmmyyhhmmss")
            Dim FileName As String = Path.GetFileName(FileUpload1.PostedFile.FileName)
            Dim Extension As String = Path.GetExtension(FileUpload1.PostedFile.FileName)
            Dim FolderPath As String = ConfigurationManager.AppSettings("FolderPath")
            Dim FilePath As String = Server.MapPath(FolderPath & "PLPS" & txtRecivedDate.Text & Extension)





            FileUpload1.SaveAs(FilePath)
            WSheet = ""
          
            xlApp = New Excel.ApplicationClass
Posted
Updated 10-Nov-19 7:19am

The reason the COM failure shows up is because Office is not installed.

But, you cannot use Office Interop in a web application. It will work on your dev machine, but once you upload the web application to a host and multiple uses start using, it will fail.

You need to use a library that does not depend on Office being installed to retrieve the data. If the data in the Excel sheet is in tabular format, you use OleDb (database) methods to get the data, treating your Excel sheet as a rudimentary database table.

If the data is in specific cells, you would need to use something like the OpenXML SDK to get at the data in the cells.
 
Share this answer
 
Comments
Member 10194266 17-Nov-19 12:43pm    
Thanks Dave
 
Share this answer
 
Comments
Member 10194266 10-Nov-19 13:19pm    
Sorry Rechard i have already done this thing , but error is showing again
Richard MacCutchan 11-Nov-19 4:01am    
See answer below.
Member 10194266 17-Nov-19 12:43pm    
Thanks Richard

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900