konradsadek
asked on
ASP Reading of Columns from Excel 2003
I am trying to read in data from an Excel Spread sheet, however, I am getting the following error:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Excel Driver] Cannot open database '(unknown)'. It may not be a database that your application recognizes, or the file may be corrupt.
I am attaching the code that I wrote. Please note that I have already defined the "name" of the range to "my_range" and the rows "NAME" and "EMAIL" already exist.
Can anyone see what I am doing wrong? Thanks!
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Excel Driver] Cannot open database '(unknown)'. It may not be a database that your application recognizes, or the file may be corrupt.
I am attaching the code that I wrote. Please note that I have already defined the "name" of the range to "my_range" and the rows "NAME" and "EMAIL" already exist.
Can anyone see what I am doing wrong? Thanks!
' Set Connection Params
Set oConn = Server.CreateObject("ADODB.connection")
oConn.Open "Driver={Microsoft Excel Driver (*.xls)}; DriverId=790;" &_
"DBQ=c:\Inetpub\wwwroot\excel\excel.xls;"
Set RS=Server.CreateObject("ADODB.recordset")
' Write the SQL Query
RS.open "SELECT * FROM my_range", oConn
do until RS.EOF
Response.Write ( RS("NAME") & " -- " & RS("EMAIL") & "")
RS.movenext
Loop
RS.Close
oConn.Close
Set RS = Nothing
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.