| | |
excel file upload problem
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jan 2008
Posts: 2
Reputation:
Solved Threads: 0
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
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
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
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
![]() |
Similar Threads
- Exporting ASP pages to Excel (ASP)
- Import Data From Excel (ASP.NET)
- wxPython Error while running. (Python)
- read excel records in asp not refreshing (is the excel file cached) (ASP)
- HiJack This Log - xod.dll problem (Viruses, Spyware and other Nasties)
- Export from Excel help needed (Mac Software)
- Problem after installing MessengerPlus! (Viruses, Spyware and other Nasties)
- Bridge.dll Problem (Viruses, Spyware and other Nasties)
Other Threads in the ASP.NET Forum
- Previous Thread: gridview update error
- Next Thread: Sorting problem ?
| Thread Tools | Search this Thread |
.net 2.0 3.5 activexcontrol advice ajax alltypeofvideos asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox class click commonfunctions compatible confirmationcodegeneration content contenttype countryselector courier css dataaccesslayer database datagrid datagridview datagridviewcheckbox datalist deadlock development dgv dropdownlist dropdownmenu edit expose flash flv formatdecimal forms formview gridview homeedition iframe iis javascript jquery list listbox login menu microsoft mono mouse mssql multistepregistration nameisnotdeclared news numerical objects order panelmasterpagebuttoncontrols problem radio ratings rotatepage save schoolproject search security serializesmo.table silverlight smartcard sql sql-server sqlserver2005 suse textbox tracking unauthorized validation vb.net video videos virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopemnt webservice wizard xml youareanotmemberofthedebuggerusers





