Link to home
Start Free TrialLog in
Avatar of Jerry Newman
Jerry NewmanFlag for United States of America

asked on

Connection to Excel 2007

I have a web site that uses an Excel 2007 spreadsheet to store information for displaying new pages when buttons are clicked.  It has been function for more than a year with the following connection information

mystring="Driver={Microsoft Excel Driver (*.xls)};"
mystring=mystring & "DriverId=790;Dbq="& Server.MapPath("2012_SimplifiedItemsForSale.xls")

This now fails with the following error message:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Excel Driver] Reserved error (-5016); there is no message for this error

Searching the web, I found that many people have seen this error, and the recommendation is to use a different OLEDB driver.

I downloaded and installed AccessDatabaseEngine from Microsoft site and changed the code to the following:

mystring="Provider=[Microsoft.ACE.OLEDB.16.0]"
mystring=mystring & Server.MapPath("2012_SimplifiedItemsForSale.xls")

The new error code is:

ADODB.Connection error '800a0e7a'
Provider cannot be found. It may not be properly installed

Q1.  Can anyone tell me if I have properly written the code to use the new OLEDB?
Q2.  Is there another step that must be taken to be able to use the driver software?

Office 2007 is installed in c:\Program Files (x86)

Help. Please.
Avatar of Big Monty
Big Monty
Flag of United States of America image

I think you want to use version 12 for Office 2007

mystring="Provider=[Microsoft.ACE.OLEDB.12.0]"
mystring=mystring & Server.MapPath("2012_SimplifiedItemsForSale.xls")

more info - https://www.connectionstrings.com/ace-oledb-12-0/
Avatar of Jerry Newman

ASKER

Big Money,
Thanks for your comment.
I made the change you suggested, but still get the error.
Does the driver have to be registered?  If so,  how do I do that?
is office 2007 installed on the server?
Big Monty.  Thanks for your comment.

Office 2007 is installed on a local development server with Windows 7 Home Premium running IIS 7.  Until recently, the process was working for a year or more on both my test machine (localhost) and on the web site hosted by GoDaddy.

Here is the current connection string and error message.
---------
 Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Server.MapPath("2012_SimplifiedItemsForSale.xls");readonly="false";Extended                          Properties="Excel 12.0;HDR=YES:IMEX=1";
ADODB.Connection error '800a0e7a'

Provider cannot be found. It may not be properly installed.
-------------
I have checked to see if ACEOLEDB.dll is located in the proper place and if it is present in the registry.  It appears in both places.  

My nest steps will be to
uninstall microsoft.ace.oledb.12.exe.
reboot
re-install microsoft.ace.oledb.12.exe.  

Do you have another suggestion?
check the permissions on where the dll is. since its your local machine, set it to Everyone (which you can change later) and see if that works.
Thanks for the suggestion.  I checked.  Everyone has permission.
then i would go with the uninstall / reinstall and see how that goes
I'll let you know what happens.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.