OLEdb problem

  • Thread starter Thread starter EMW
  • Start date Start date
E

EMW

I use the following function to read an Excel worksheet into a dataset:

Public Function GetDataFromExcel(ByVal FileName As String, ByVal ds As
DataSet) As Boolean
Try
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=" & FileName & "; Extended Properties=Excel 8.0;"
Dim objConn As New System.Data.OleDb.OleDbConnection(strConn)
objConn.Open()
' Create objects ready to grab data
Dim objCmd As New System.Data.OleDb.OleDbCommand("SELECT * FROM
[sheet1$]", objConn)
Dim objDA As New System.Data.OleDb.OleDbDataAdapter
objDA.SelectCommand = objCmd
' Fill DataSet
objDA.Fill(ds)
' Clean up and return
objConn.Close()
Return True
Catch ex As Exception
lblHeading.Text = ex.ToString
Return False
End Try
End Function

When I run my ASPX on my own PC it runs fine and does what it must do.

When I put the page on the server I get this message:

System.Data.OleDb.OleDbException: Unspecified error at
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) at
System.Data.OleDb.OleDbConnection.InitializeProvider() at
System.Data.OleDb.OleDbConnection.Open() at
FSsite.FSsite.WebFormSubmit.GetDataFromExcel(String FileName, DataSet ds)

Now I copied to System.Data.OleDb.dll file to the BIN folder at the IIS
webserver, but is there anything else I should do?
Can anyone explain to me what this means, it's a little vage error message?

thanks,
Eric
 
I would guess a security error, or a path error.
What is the FileName, and can ASPNET (or the ASPNET use id on the server)
read it ?
I would highly doubt that you need Oledb.dll in the bin directory.
 
Back
Top