3
votes

I can't open an Excel spread sheet with .NET on an x64 server using the following connection string

"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + filePath + "; Extended Properties=Excel 8.0;"

I get The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.

I installed the 2007 Office System Driver: Data Connectivity Components and tried with Microsoft.ACE.OLEDB.12.0 and this connection string

"Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + filePath + "; Extended Properties=Excel 8.0;"

and got "The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine."

I searched Google with the only response being it's a 64 bit problem, anyone have an Idea how to fix this?

2

2 Answers

2
votes

The Excel 2003 / 2007 OleDB drivers are 32 bit only. My understanding is that you can only use them in a 32 bit application.

SpreadsheetGear for .NET will open xls and xlsx workbooks and it is tested and supported in 64 bit as well as 32 bit .NET 2.0+.

You can download the evaluation here and see live ASP.NET samples (C# & VB) here.

Disclaimer: I own SpreadsheetGear LLC

3
votes

Your application needs to be set to run as a 32 bit application. This can be accomplished by changing the Target Platform for your executable project from AnyCPU to x86 in the Visual Studio Configuration Manager.

If you want to test how this will work with your application prior to changing your solution configurations you can use the corflags.exe utility. This will only work provided your application is not strong named or Authenticode signed, otherwise you will need to resign it. From a Visual Studio Command Prompt type:

corflags.exe <path and exe file name> /32BIT+