Upload An Excel File in Classic ASP On Windows 2003 x64 Using Office 2010 Drivers - excel

So, we are migrating an old web app from a 32-bit server to a newer 64-bit server. The app is basically a Classic ASP app. The pool is set to run in 64-bit and cannot be set to 32-bit due to other components. However, this breaks the old usage of Jet drivers and subsequent parsing of Excel files.
After some research, I downloaded the 64-bit version of the new 2010 Office System Driver Beta and installed it. Presumably, this allows one to open and read Excel and CSV files.
Here's the snippet of code that errors out. Think I followed the lean guidelines on the download page:
Set con = Server.CreateObject("ADODB.Connection")
con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.14.0;Data Source=" & strPath & ";Extended Properties=""Excel 14.0;"""
con.Open
Any ideas why?
UPDATE: My apologies. I did forget the important part, the error message:
ADODB.Connection error '800a0e7a'
Provider cannot be found. It may not
be properly installed.
/vendor/importZipList2.asp, line 56
I have installed, and uninstalled/reinstalled twice.

I encountered a similar issue a little while ago and I found out that there's actually a bug in the installer package for the ACE 14 driver. The driver is being registered as "Microsoft.ACE.OLEDB.12.0". In my case I could get things to work just by changing my connection string to 12 as opposed to 14.
Evidence on the bug: Microsoft Connect

It could be the Excel version in the Extended Properties parameter. Excel 14 is for Office 2010. While the driver may be Office 2010 I would presume your Excel documents are not.
Excel 2007 - v12
Excel 2003 - v8
From http://www.connectionstrings.com for Excel 2007:
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myExcel2007file.xlsx;Extended Properties="Excel 12.0 Xml;HDR=YES";
You could try replacing the ACE.OLEDB.12.0 with ACE.OLEDB.14.0 to match the driver version.

Here http://forums.asp.net/p/1128266/1781961.aspx is a suggestion to split your app into 32 and 64 bit components and transfer data via COM. To quote:
What you need to do is split your application into a 32 bit part and a 64 bit part, use COM interop to cross the 64/32 bit boundary. For instance, drop the code (just a simple class library compiled as 32 bit) that retrieves the Excel data into a COM+ (System.EnterpriseServices) as a "server type" application, and call that server methods from your 64 bit Windows service. This is exactly why System.EnterpriseServices are made for.

Looks like it is "14" ("14.0") for Excel. But "12" ("12.0") for ACE.
From this download:
http://www.microsoft.com/downloads/en/details.aspx?familyid=C06B8369-60DD-4B64-A44B-84B371EDE16D&displaylang=en
I found this snipplet:
**2.If you are an application developer using OLEDB, set the Provider argument of the ConnectionString property to “Microsoft.ACE.OLEDB.12.0”
◦If you are connecting to Microsoft Office Excel data, add “Excel 14.0” to the Extended Properties of the OLEDB connection string.**
HOWEVER!!!
The instructions from the download page seem to be wrong....causing some of this confusion.
From here:
http://social.msdn.microsoft.com/Forums/en/adodotnetdataproviders/thread/686d8ebb-0da3-4f0c-bf16-9c650f8dcb32
//Quote //Paul P C
The instructions are incorrect. It should be Excel 12.0. I wish they would fix this mistake at the download site.
//End Quote
I have verified that this connection string works for me:
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source='C:\MyFile.xls';Extended Properties='Excel 12.0;HDR=NO;IMEX=1;';"

I faced the same problem, finally, I realized that the error is that the connection string should be modified in 64 bit!
To get the right one, install visual basic 6 and drag the Microsoft data access control,through its wizard, open the file you want, and let it write the connection string to you.

Related

Provider cannot be found ADODB error while connecting to Excel 2016 or CSV from Internet Explorer

Background: In our organization, there is a html tool which runs in the Browser(IE11). The tool has a couple of stages and data from each stage is stored in a SharePoint list. In the final stage, all this data needs to be reconciled from a data set which comes from banks in a spreadsheet. Here the tool uses ADODB connection to connect to the Excel file, read the data from it and match with the data on SharePoint.
Problem: Recently after a windows 10 upgrade, the tool stopped exactly on the connection line throwing an error - "Provider cannot be found. It may not be installed correctly". I also got the Microsoft access Database engine re-installed from IT but to no good(this was after reading about answers to my query online)
I am the developer of this tool and it works just fine on my laptop. Below are the specifications of the connection string and other details of software installed
Windows Version: 1511(OS Build 10586. 1176) Windows 10 64 bit
IE: 11
IE version: 11.1176.10586.0
IE Update Version: KB4040685
Office: 2016
Connecting to Excel(version) - 2007-2010 (xls, xlsx format)
Connection Object: ADODB.Connection (via ActiveXObject in JavaScript )
Connection String Parameters
•Provider - Microsoft.ACE.OLEDB.12
•Extended Properties - Excel 8.0 (Also tried Excel 12.0 xml)
•HDR - Yes
•IMEX = 1
OLEDB Drivers installed on the machine: Microsoft ACE 12.0, 16.0 and Jet 4.0
This is the exact same configuration on my laptop and the tool is easily able to connect to Excel or Access also for that purpose.
I have also tried the below, nothing was a success
1.Used Jet.4.0 in the connection string - Here I got error "External table is not in the expected format" & "Unexpected error from database"
2.Tried using ODBC drivers with error - "Data source name not found and no drivers installed"
3.Opened the tool in 32 bit environment
4.Made a HTA app and ran that in 32 bit mode
I also found that in my laptop in the Microsoft Shared folder within program files, there exist Office 14 & 15 folders, but they don't exist in the newer laptops and the same in 32 bit folder of Program files(x86). Would it be possible that having those folders is making the difference?
Please help.
I have learned that installing Microsoft Access Database Engine 2010 (or 2007) on end-user machines fixes the issue, as adodb.dll file is required to be registered on computers using that provider.

ODBC Excel Driver: Unexpected error from external database driver

Since the Windows update from October 10, the ODBC Excel drivers have stopped working. We get the following error when trying to read a file:
"Unexpected error from external database driver (1)"
We open Excel files in Delphi using an ADO connection with the following connection string:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1";
I can get it to work by switching to Microsoft.ACE.OLEDB.12.0, but for that to work, all our customers would have to install the Microsoft Access Database Engine Redistributable on all the computers they use our software on.
Does anybody have another solution or workaround? Thanks in advance.
On a customers machine I have deinstalled KB4041681 (Windows 7) which came with last Microsoft Patch.
On my machine I have deinstalled KB4041676 (Windows 10).
After that Microsoft.Jet.OLEDB.4.0 is now working.
I hope that Microsoft will fix this bug soon.
There is one solution. Replace "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1"
with Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\MyExcel.xls; Extended Properties=\"Excel 12.0;HDR = YES;
After this change you will have to install 2007 Office System Driver: Data Connectivity Components from link on customer machine.
I had the same problem with 2 applications developed by me since 3 years (c# and java).
Since 10-oct-2017 I couldn't export to excel 2003 but 2007 worked, and couldn't import from excel 2003 but 2007 worked too for import.
In ArcGIS Desktop 10.5.1 By ESRI (a most popular software for Geographic processing) Couldn't open excels 2003 and .mdb files.
Temporally Solution: uninstall KB4041693, KB4041687 in windows 8.1 (maybe for w10).
In microsoft changelog of both path say something about "updates [...] and security updates for microsoft jet".
After uninstall and restart all softwares becomes to be normal again.
this problem was introduced in 10-oct-2017.
In microsoft forums this problemas was reported (kb4041693 should "fix" it but still doesn't work).
Maybe in few weeks they will path (properly) this issue.
For me, it worked following these steps:
ps.: We have a Windows Server 2008R2
1 – Download and install this: https://www.microsoft.com/en-us/download/details.aspx?id=23734
2 – Open the .dtsx file and change your Excel connection. On the properties dialog, Click on the three dots in the ConnectionString property and change it to Microsoft Excel 2007. This will automatically change your connection string to:
Provider=Microsoft.ACE.OLEDB.12.0;Data Source={YOURPATH};Extended Properties=”Excel 12.0 XML;HDR=YES”;
3 – Some of our .dtsx files point to a config file (usually has a .dtsConfig extension). I also changed these guys to point to the right provider (pretty much copied and pasted the connection string I got from visual studio)
After this, I ran the SQL Job again and it worked fine.
If you are working with SSIS package then please change your Excel Sheet version 2003 to 2007 in Excel Source or Excel destination.Generally this issue due to excel version.
I had the same problem. Changed Excel 2007 in Excel destinations. It worked. This is same as changing the provider=Microsoft.ACE.OLEDB.12.0.
HERE is the solution... i found it in another forum and work perfectly for me...
it will works 100%
As mentioned in the following:
https://forums.embarcadero.com/thread.jspa?messageID=902557&tstart=0
https://forum.kanors-emr.org/showthread.php?tid=571&pid=2652#pid2652
The KB4041681 installs version 4.0.9801.1 of msexcl40.dll.
Find prior version (4.0.9801.0) of msexcl40.dll
Place in another directory. They suggest the application directory, but since in the next step you will modify registry to point to this older version, it can probably go anywhere.
Update registry key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Jet\4.0\Engines\Excel\win32 to point to the location from step 2.
Uninstall these updates(according to your OS) and your code will start running normally
KB4041681 - Windows 7 SP1 and Windows Server 2008 R2 SP1
KB4041690 -Windows Server 2012
KB4041693 - Windows 8.1 and Windows Server 2012 R2
KB4041678 - For me this was the issue
https://support.microsoft.com/en-in/help/4041678/windows-7-update-kb4041678
This problem was introduced by a recent update of Microsoft Office. there are not alternative solutions at the moment.

Error in OleDbConnection.Open() when trying to read Excel XLSB

I'm using Visual Studio 2013 with MVC 3 Razor. I'm able to upload and save XLSB file, and I'm trying to read data from the uploaded XLSB. I have the below connection string and method to initialize the OleDbConnection:
strConStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Projects\Excel1.xlsb;Extended Properties='Excel 8.0;HDR=True'";
OleDbConnection connExcel = new OleDbConnection(strConStr);
The error occur at connExcel.Open(). Below is the error message:
An exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll but was not handled in user code
Additional information: This file was created in a previous beta version of Excel 2007. Open the file with Excel 2007 to save it to the most recent version of the Excel 2007 file format before opening the file in Access 2007.
I had AccessDatabaseEngine installed in my PC. In my control panel, I have the following installed engine info:
Name: Microsoft Office Access database engine 2007 (English)
,Size: 19.2 MB
,Version: 12.0.4518.1031
I'm not sure if this is the correct version to read XLSB file. My PC is x64 bit by the way.
My colleague also have the same type of Microsoft Office Access database engine 2007 installed in his PC but his version is "12.0.66XX", the code works fine on his side.
Please let me know if I need to install another version of Access Database Engine, or any other way to resolve this error.
I'm able to resolve this after a long studies and research.
Apart of the Microsoft Office Access database engine 2007 that is already installed in my machine, I also download and install Microsoft Access Database Engine 2010 Redistributable.
After that, I need to download Microsoft Office Access Runtime and Data Connectivity 2007 Service Pack 2 (SP2) to install and then reboot my machine.
Everything work like magic afterwards.
And this is my working connection string:
strConStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Projects\Excel1.xlsb;Extended Properties='Excel 12.0;HDR=True'";

SSIS and 64bit excel

I have researched this thoroughly but I've yet to find a satisfactory answer.
I am using SQL Server Data Tools 2010 and Microsoft Office 2013 64-bit. I know that there is a compatibility problem and I am trying to solve it because I know for a fact that you can use an .xlsx file as a data source in a Data Flow.
First I tried setting Run64BitRuntime to False in Project -> Properties -> Configuration Properties - > Debugging but it didn't work
Whenever I try importing an .xlsx file I get the same error
Microsoft Visual Studio
------------------------------
Could not retrieve the table information for the connection manager
'Source Path'. Failed to connect to the source using the connection
manager 'Source Path'
------------------------------
So I tried downloading the "Microsoft Access database engine 2010" as so many suggested. The 64-bit installed successfully but the 32-bit returned the following error
You cannot install the 32-bit version of Microsoft Access database engine 2010
because you currently have 64-bit Office products installed.
Now I know I am missing a step here cause while I can see "Microsoft Access database engine 2010" in the list of installed programs in control panel it does not show up as an option in the Provider list when I am trying to create a new Connection Manager.
So before I result following the instruction on this blog I would like to ensure there is no easier way of solving the problem
Thank you in advance for you time.
If you're machine is x64, forget about Excel, as there is no driver available.
Just convert the file to CSV and use a Flat File Connector instead.
Ok, the answer was so ridiculously easy that I kind of feel ashamed for this post now.
If you are using Microsoft Office 2013 64-bit and want to work with SSIS you have to download and install the 32-bit Microsoft Access Database Engine 2010 Redistributable, not the 64-bit, set Run64BitRuntime to False and everything will work like a charm.

Excel ODBC and 64 bit server

using ASP.NET I need to update an excel template.
Our server is running Windows 2008 in 64 bit mode.
I am using the following code to access the excel file:
...
string connection =
#"Provider=MSDASQL;Driver={Microsoft Excel Driver (*.xls)};DBQ=" + path + ";";
...
IF the application pool is set to Enable 32 bit applications the code works as expected; however the oracle driver I am using fails as it is only 64 bit.
If Enable 32-bit applications is set to false the excel code fails with the error:
Data source name not found and no
default driver specified
Any suggestions?
The Microsoft Office team has just released a 64-bit driver
Microsoft release a 64bit OLEDB FOR ODBC in 2008/04/04
http://www.microsoft.com/downloads/details.aspx?FamilyID=000364db-5e8b-44a8-b9be-ca44d18b059b&DisplayLang=en
Now you should able to run everything 64bit, can u try it and let us know the result and personally I think Microsoft should release a 64bit Jet Oledb 4.0, if the development team has no time to do it then just put it in codeplex.com and let other programmers do it.
There is also 2010 Office System Driver Beta: Data Connectivity Components
Link which has allowed us to open Excel 2007 (XLS) from a 64bit environment.
This download will install a set of components that can be used by non-Microsoft Office applications to read data from Microsoft Office 2010 Beta files
Our connection string
#"Provider=Microsoft.ACE.OLEDB.12.0;Data Source= " + filePath + ";Extended Properties=\"Excel 12.0;HDR=YES;\""
There are no office drivers for 64bit released.
The (currently) last post at this link:
MSDN Forum details a cumbersome and ugly workaround. You could also replace the Windows Service with a COM exposed assembly, if you wish. Still ugly though. :)
Install the 32-bit Oracle driver and enable 32 bit applications?

Resources