Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

I am using the following code to import excel to gridview in asp.net. The code is working fine on my laptop but the same is not working on client site either on server or on users. pls suggest..

VB
Protected Sub btnUpload_Click(sender As Object, e As EventArgs) Handles btnUpload.Click
       Try
           If FileUpload2.HasFile Then
               Dim FileName As String = Path.GetFileName(FileUpload2.PostedFile.FileName)
               Dim Extension As String = Path.GetExtension(FileUpload2.PostedFile.FileName)
               Dim FolderPath As String = ConfigurationManager.AppSettings("Folderpath")

               Dim FilePath As String = Server.MapPath(FolderPath + FileName)

               FileUpload2.SaveAs(FilePath)

               Import_To_Grid(FilePath, Extension, rbHDR.SelectedItem.Text)
           End If
       Catch ex As Exception
           fnMessage(Me, ex.Message)
       End Try

   End Sub


Thanks
Posted
Comments
Mehdi Gholam 2-Apr-15 5:03am    
What is in Import_To_Grid()?
Richard MacCutchan 2-Apr-15 6:01am    
Are you using Excel.Interop?
ZurdoDev 2-Apr-15 7:53am    
What error do you get?
atul sharma 5126 3-Apr-15 6:47am    
Dear All,
Thanks for the replies:
The error shown after removing the try was:
Oledb.12.0 is not registered

I tried solutions as per net but did'nt worked. Now I have noticed that the server OS is 64 bit whereas the excel on server is 32 bit. Can that be the reason?

Thanks again for your concern!

1 solution

Installing 64 bit office did the trick..
 
Share this answer
 

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