Using OLEDB 4.0 to read excel spreadsheet doesn't work on vista32

  • Thread starter Thread starter David
  • Start date Start date
D

David

Hi - i have coded a page that opens an excel spreadsheet using oledb and it
works fine when i run it on an XP environment but on vista 32 it opens the
spreadsheet but cannot find the sheet (ie: table). keep getting Message =
"The Microsoft Jet database engine could not find the object 'schedule$'.
Make sure the object exists and that you spell its name and the path name
correctly.". The path is correct, the sheet name is correct. Again, works on
XP but not Vista. tks.

code

Protected Function GetDivision() As Data.OleDb.OleDbCommand

' Connect to the Excel Spreadsheet
Dim xConnStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("schedule.xls") & ";" & _
"Extended Properties=Excel 8.0;"
' create your excel connection object using the connection string
Dim objXConn As New Data.OleDb.OleDbConnection(xConnStr)
Dim sqlStr As String = "SELECT DISTINCT [Div] FROM [schedule$] order
by [Div]"
objXConn.Open()

Dim objCommand As New Data.OleDb.OleDbCommand(sqlStr, objXConn)
Return objCommand

End Function
 
Thanks for your prompt reply. i did peform numerous searches prior posting
and found nothing that helped. my web site environments are identical on XP,
as Vista and the workbook and sheet definitely exist. As well, on Vista i am
running under admin. The interesting thing is that the connection/cmd.state =
1 (Open).
 
Back
Top