views:

7041

answers:

2

I created a windows application developed in .NET 3.5 in a 32 bit Windows 2008 server. When deployed the application in a 64 bit server it shows the error "Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine ".

So as a solution to this issue, i have changed the build property of the project to X86, so that it will build in 32 bit mode, and rebuild the project in the 32bit machine. But, the same project uses other DB drivers (DB2, SQL etc.) to connect to other databases. So when i deployed my app again in the 64 bit OS, it throws the exception " Attempted to load a 64-bit assembly on a 32-bit platform. "

I am using the Microsoft.Jet.OLEDB.4.0 driver to read and write to the Excel (.xls)

Any help will be really appreciated...

Thnks.

A: 

There isn't a 64 bit provider for Jet. If you want to support multiple DB sources including Jet to Excel you will need at least that part of your application to run in a 32 bit process.

The error you are getting when you compile for x86 is a bit strange. I can't see how you would end up referencing 64 bit assemblies in this case.

AnthonyWJones
Anthony, How i can make only some part of a project to run in 32bit mode? All these DB connections, including Excel, will come under one project.Also i got the error in x86, when i try to run it in the 64 bit OS. I think this is because the DB2 driver installed in the 64bit OS is a 64bit version and when it is refferenced from the application, which is configured to run in 32 bit mode, causes the error.
rookie
If splitting up the project into multipe exes is more hassle than its worth the you are left with only compiling to 32bit. As to the DB2 issue you would to look for some DB2 experts on this perhaps another DB2 specific question. Typically things like SQL Server will install both 32 bit and 64 bit providers on a 64 bit machine.
AnthonyWJones
Thanks Anthony for your comments. From doing a lot of search on this issue and from your comments, what i understood is, i have to create the part of the project which process the excel sheet as a separate project and make it compile in 32 bit version.
rookie
Just so people know, A2010 will have 64-bit Jet.
David-W-Fenton
Thanks David, 2010 do have a 64 bit driver
rookie
+12  A: 

Hi, I found a solution for this problem. The issue I described in my question occured basically due to the incompatibility of the Microsoft.Jet.OLEDB.4.0 driver in 64 bit OS.

So if we are using Microsoft.Jet.OLEDB.4.0 driver in a 64 bit server, we have to force our application to build in in 32 bit mode (This is the answer i found when i did an extensive search for this known issue) and that causes other part of my code to break.

Fortunately, now Microsoft has released a 64 bit compatible 2010 Office System Driver which can be used as replacement for the traditional Microsoft.Jet.OLEDB.4.0 driver. It works both in 32 bit as well as 64 bit servers. I have used it for Excel file manipulation and it worked fine for me in both the environments. But this driver is in BETA.

You can download this driver from 2010 Office System Driver Beta: Data Connectivity Components

Thnks

rookie
It won't be in beta any longer by the time Office 2010 is released, sometime by mid-year 2010, if I'm remembering correctly.
David-W-Fenton