excel file upload problem

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Jan 2008
Posts: 2
Reputation: mihirtalks is an unknown quantity at this point 
Solved Threads: 0
mihirtalks mihirtalks is offline Offline
Newbie Poster

excel file upload problem

 
0
  #1
Jan 15th, 2008
hello,
i am uploading an excel file from my web application and is working fine from the local machine but gives an error "unspecified error" when i try to upload from another machine.
i have used oledb connection with Microsoft.Jet.OLEDB.4.0. i have kept 'impersonation = true' in my web.config file and all the rights are given to the user.
pls help me with this
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 175
Reputation: Kusno is an unknown quantity at this point 
Solved Threads: 13
Kusno's Avatar
Kusno Kusno is offline Offline
Junior Poster

Re: excel file upload problem

 
0
  #2
Feb 27th, 2008
Try this code :
My friend use this code to read excel file.

Protected Sub ActionUpload()
Dim MyConnection As OleDbConnection
Dim myPath As String = ""
Dim TableName As String = "TrxGCMSStatistic"
Dim CnSP As SqlClient.SqlConnection = Nothing

If FUAttach1.FileName <> "" Then
FUAttach1.SaveAs(Request.MapPath(Request.ApplicationPath) & "/Upload/GCMS/" & FUAttach1.FileName)
End If

myPath = Request.MapPath(Request.ApplicationPath) & "\Upload\GCMS\" & FUAttach1.FileName

Try
Dim objDS As DataSet = New DataSet
Dim objCmd As OleDbCommand
Dim objAdapter As OleDbDataAdapter = New OleDbDataAdapter

MyConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & myPath & ";Extended Properties=""Excel 8.0;IMEX=1;HDR=YES;""")
MyConnection.Open()

'Select the data from Sheet1 of the workbook.
objCmd = New OleDbCommand("select * from [Sheet1$]", MyConnection)

objAdapter.SelectCommand = objCmd
objAdapter.Fill(objDS, "XLData")



MyConnection.Close()

Catch ex As Exception
UserMsgBox(Me, ex.Message)
End Try
End Sub
NEVER NEVER NEVER GIVE UP
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ASP.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC