开发者

C# application with access database won't work on 64 bit windows 7

开发者 https://www.devze.com 2023-02-13 01:33 出处:网络
I made C# application for my friend which has connection to access database (mdb file). I have developed application on my computer with win7 x86 installed. My friend had XP and it worked perfectly, b

I made C# application for my friend which has connection to access database (mdb file). I have developed application on my computer with win7 x86 installed. My friend had XP and it worked perfectly, but now he开发者_开发百科 installed win7 x64 and application doesn't work. In fact, application starts and behave regular, but cannot connect to database... Database too can be opened with access, but my application cannot connect to it. What can be a problem? How to make my application works on both operating systems?

regards,

Vajda


Ask your friend to download and install the following file:

  • Microsoft Access Database Engine 2010 Redistributable

and make sure he picks the 64-bit version there (AccessDatabaseEngine_x64.exe).

By default there is no 64-bit ODBC/OLEDB driver for Access installed, but the 2010 version should work for 2007 databases as well.

You could probably also configure your program to be built for the x86 target. That would run the program as a 32-bit program, even on 64-bit OS.


Most likely, the .Net CLR is trying to fire the app up in 64bit mode by default on his new win7 box and this might be causing some issues with the referenced assemblies.

The first thing I would try is to change the Platform target of the application (go to Project properties in Visual Studio for the application) to x86 (from Any CPU) to force the application to run in 32bit mode.

If this works, you will have narrowed down your problem.

Then, after building the project, look in the bin folder to see which assemblies are being copied to the output folder. If you see any System.Data... or any other .Net assemblies that are already contained in the GAC, you'll want to delete these and then try to fire it up. This will force the application to use GAC assemblies written for 64bit use.

0

精彩评论

暂无评论...
验证码 换一张
取 消