views:

208

answers:

2

I wrote an application with VS2008 on Windows XP, and produced an .EXE file.

This application will only run on Windows XP OS. It fails on Vista and Windows 7.

It gives an error saying that a Microsoft OLEDB JET 4.0 occurred.

I use Microsoft Access as a db in this app.

What should I do?

+1  A: 

If your application is built for "any CPU" and you're running under x64 variants of Windows 7 and Vista, then try setting your build configuration to x86 (i.e. The 32 bit variant). There aren't x64 drivers for Access as far as I'm aware.

Good luck

Moleski
Remou
Sorry,i don't undrestand.You mean that when i want to run the app in vista or 7,i have to install the Jet 4.0 related to each OSs?
SamanehHasani
Not really. First of all: are you running under x64 variants of Windows 7/Vista. If so then you have two choices: 1) Build for 32 bit CLR (could be easiest route) or 2) install x64 drivers for access (from the link given by Remou). If you're running on a 32 bit o/s, then neither my answer (or comments) really apply.
Moleski
Looks like Moleski is right. see this other question http://stackoverflow.com/questions/1735392/the-microsoft-jet-oledb-4-0-provider-is-not-registered-on-the-local-machine
MarkJ
A: 

Where is the access database: is it in Program Files? In which case you might be suffering from virtualization - on Windows Vista and 7 the operating system won't allow you to write to Program Files, so it silently redirects you to another directory.

MarkJ
I did what you said,but it didn't work and the same error occured: Microsoft Jet 4.0 OLEDB isn't registered in local machine.
SamanehHasani
For what it's worth, the Programs folder has not been an appropriate location for user-writable data since the release of Windows 2000, i.e., more than 10 years ago. User-writable data belongs in the user's profile and nowhere else.
David-W-Fenton