Cannot open XLSX file from an ASP.NET using OLEDB

G

Guest

Hi,

In a ASP.NET 2.0 web page, I have the following code to connect to a Excel
2007 XLSX file (stored in the temp directory of the Windows account running
the application pool), in order to open it and retrieve some colums and rows.

const string excel2007connectionString =
@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended
Properties=""Excel 12.0;HDR=No;IMEX=1""";

connectionString = String.Format(connectionString, filename);
OleDbConnection excelConnection = new OleDbConnection(connectionString);
OleDbCommand excelCommand = new OleDbCommand();
excelCommand.Connection = excelConnection;
OleDbDataAdapter excelAdapter = new OleDbDataAdapter(excelCommand);

excelConnection.Open();

The code works like a charm on my dev machine (where I have 2007 Office
installed), but on the test server (where there is no Office installation) it
does not work.
The error message returned when opening the Excel file is: No error message
available, result code: E_FAIL(0x80004005).

I have already installed the 2007 Office System Driver - Data Connectivity
Components (AccessDatabaseEngine.exe) from
http://www.microsoft.com/downloads/...36-8C28-4598-9B72-EF94E038C891&displaylang=en
I have also installed the Access runtime (AccessRuntime.exe) from
http://www.microsoft.com/downloads/...D9-9DC6-4B38-9FA6-2C745A175AED&displaylang=en
Since the Access team claims in their blog that the formet JET engine (now
renamed to ACE) is owned by them and that the 2007 release is a private,
customized copy of the JET engine for Access 2007, I thought that it might
help as well. I have rebooted the server, after installing both downloads.

Is there any other component missing, that I need to install? Funny thing is
that in the ODBC Administrator applet, I can see the driver installed
(ACEODBC.dll version 12.00.4518.1014), but yet, everything I have tried fails
to open the Excel file.

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top