嗨朋友们。请帮帮我。 Postgres连接C#2.0无法在Windows 8 64位工作!!!!

问题描述:

亲爱的朋友们,



我收到错误信息





错误[IM002] [微软] [ODBC驱动程序管理器]未找到数据源名称且未指定默认驱动程序





我是使用VS 2005和ADO.net编程。





我正在运行Windows 8 64位。



我安装了64位dotnet框架,Crystal报告设置为V2.0,Postgres 8.2,postgres odbc连接器设置(从postgres网站下载),在控制面板中创建DSN - >管理工具 - > ODBC 32位 - >系统DSN - > Postgres ANSI。



但是我的APP仍然无法工作





请帮帮我。



这个应用程序在Windows XP,Vista,7中运行正常。但是在Windows 8中不起作用。

Dear Friends,

I have got the error message


ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified


I am using VS 2005 and ADO.net programming.


I am running windows 8 64 bit.

I have installed 64 bit dotnet framework, Crystal reports setup for V2.0, Postgres 8.2, postgres odbc connector setup (Downloaded from postgres website), Created a DSN in Control panel -> Administrative tools -> ODBC 32 bit -> System DSN -> Postgres ANSI.

But still my APP is not working


Please help me out.

This app works fine in Windows xp, Vista, 7. But not working in windows 8.

可能是因为您的应用程序被编译为目标任何CPU。因此,在64位计算机上,您的代码以64位运行,在32位计算机上运行,​​代码运行为32位。



问题是你不能在同一个过程中组合32位和64位代码。您的64位应用程序无法使用32位Postgres驱动程序。所以,你有两个选择。



1)找一个64位的Postgres驱动程序并安装它。



2)进入项目Properties,Build选项卡,将目标从Any CPU更改为x86。这将强制您的代码仅在64位计算机上以32位运行。
Probably because your app is compiled to target "Any CPU". So, on a 64-bit machine, your code runs as 64-bit and on a 32-bit machine, your code runs as 32-bit.

The problem is that you cannot combine 32- and 64-bit code in the same process. Your 64-bit app cannot use a 32-bit Postgres driver. So, you have two choices.

1) Find a 64-bit Postgres driver and install it.

2) Go into your project Properties, Build tab, and change the target from Any CPU to x86. That'll force your code to run as 32-bit only on 64-bit machines.