C # uses System.Data.OracleClient to connect to an Oracle database. My is WINDOW7/64 bit system, installed a 64-bit ORALCE 11G R2 client is 64-bit with VS10 debug error message as follows:
Badimagefomatexception is raised when attempting to load the Oracle client library. This problem occurs if you are running in 32-bit mode with the 64-bit Oracle client component installed.
The cause of the error is that the VS debugging tool is 32 bits, and the OracleClient used by the connected program is also 64 bits, causing compatibility problems. Of course, if you press 64-bit to recompile a 64-bit Oracle client on a 64-bit operating system, then recompiling the program will also solve the problem. Here we introduce an easy way to connect a program if you install the Oracle database locally without having to install the client at all.
In fact, System.Data.OracleClient points to the Oci.dll under the PATH environment variable. So we just have to let the program find 64-bit or 32-bit oci.dll. Here's how:
- Download, and unzip, such as C:\instantclient-basic-win-x86-64-11.1 this is a 32-bit client C:\instantclient-basic-nt-11.2.0.3.0 If you use vs best Choose 32 bit of 64 bit I tried it as if debugging or error. Of course you are deployed to IIS to be sure that all two are available.
2. Add the above path to the system's environment variable path.
Then run the program, the program will follow the path path to find Oci.dll, the program will automatically find 32-bit or 64-bit oci.dll can connect to the database.
Oracle database Download Link:http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
If not, download the latest Oracle client:http://www.oracle.com/technetwork/topics/winsoft-085727.html