Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Databases
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 1st, 2010, 05:12 PM
Authorized User
 
Join Date: Feb 2009
Posts: 43
Thanks: 10
Thanked 0 Times in 0 Posts
Default Microsoft OLE DB Provider for ODBC Drivers error '80004005'

I am attempting to import data into from an excel file into an application using asp. My code is as follows


HTML Code:
<%
                                        
                            'Routines for fetching excel file from file system
                            Dim conn 
                            Dim rs        
                            Dim file
                            Dim arrResultSet
                            Set file = request.form("excelFile")
                            Set conn = Server.CreateObject("ADODB.Connection")
                            Set rs = Server.CreateObject("ADODB.recordset")
                            Dim connString 
                            Dim sql
                            connString = "DRIVER={Microsoft Excel Driver (*.xls)};DBQ=" & file &"; ReadOnly=0"
                             conn.Open connString
                            sql = "Select *  FROM [sheet1$];"
                            rs.Open sql, conn
                                                    
                            %>


I am using an excel file on my laptop and not on the server - the requirements for this work are that the user is able to import data from their local machine.


The following error is being returned....

Quote:
OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Excel Driver] '(unknown)' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.

/mediabin/MapMetadata2.asp, line 131


The following is line 31 - connString = "DRIVER={Microsoft Excel Driver (*.xls)};DBQ=" & file &"; ReadOnly=0"


Any help would be appreciated.
 
Old February 2nd, 2010, 01:00 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

This issue might be due to invalid Excel file and/or file path.

You can also use following connection string:

connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"";"

Or

connString = "Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=C:\MyExcel.xls;DefaultDi r=c:\mypath;"
__________________
Om Prakash Pant
Click the "Thanks" button if this post helped you.
 
Old February 2nd, 2010, 11:05 AM
Authorized User
 
Join Date: Feb 2009
Posts: 43
Thanks: 10
Thanked 0 Times in 0 Posts
Default

om_prakash - thanks for your response.

As I mentioned earlier the excel file is one the users PC and not on the server, so I cannnot specify the excel fine in the connection string.


That is why I am getting the filename from a form i.e.
Set file = request.form("excelFile")
 
Old February 2nd, 2010, 10:07 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Then you can't do it.

There is no possible way for server-side code to utilize a file on the client's machine. It would be a *HUGE* security hole!

Just think, if *this* is possible, what's to prevent every malicious web site in the world from reading all your banking information and passwords and email and more???

You would have to allow the user to upload the file to the server, first, and *then* you could analyze it on the server. Period.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft OLE DB Provider for ODBC Drivers (0x8004 phantom3008 ASP.NET 1.0 and 1.1 Basics 6 April 25th, 2007 10:30 AM
Microsoft OLE DB Provider for ODBC Drivers phantom3008 Classic ASP Basics 6 March 15th, 2007 09:39 AM
Microsoft OLE DB Provider for ODBC Drivers error ' rajiv_software Classic ASP Basics 6 April 28th, 2005 12:52 AM
Microsoft OLE DB Provider for ODBC Drivers surendran Classic ASP Databases 4 October 27th, 2003 10:23 AM
OLE DB Provider for ODBC Drivers error '80004005' Routhg Access ASP 2 June 11th, 2003 07:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.