There are a lot of problems in the middle of the 2 days because of the need to connect to Oracle database
I. Using OleDbConnection to connect to a database
------------------
PROVIDER=ORAOLEDB.ORACLE.1; User Id=sajet; Password=tech;data source= (DESCRIPTION = (address_list= (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.66.225) (PORT = 1521)) (Connect_data = (service_name = Mes3nod)));
------------------
1. Connect Oracle must be installed on the local Oracle server or Oracle client side, which happened one time because the version is not up-to-date, the program error, no way to download the installation of 11G. (There are a lot of installed tutorials on the web, either Administrator or server)
2.OCIEnvCreate failed with a return code of-1, but the error message text is not available.
This is primarily a problem with Oracle installation, Oracle cannot be installed on a virtual disk, and an exception occurs during installation to confirm that your listener is relevant. You need to set up your listeners and tnsname if you don't have a problem.
Mes3nod(This is the name of the server you want to connect to) =
(DESCRIPTION =
(address = (PROTOCOL = TCP) (HOST = 192.168.66.225 (IP address of the connecting server)) (port = 1521 (ports are generally used 1521))
(Connect_data =
(SERVER = dedicated)
(service_name = Mes3nod)
)
)
3. "Oraoledb.oracle.1" is not registered on the local computer
After this problem I tried many methods, regsvr32 Oracle's oraoledb drive "regsvr32 C:\product\11.2.0\dbhome_1\BIN\OraOLEDB11e.dll", but there was no OVA, Here's how to fix it:
First the DOS interface through Sqlplus by entering the Oracle user name password, check Oracle for problems, no problem to proceed to the next
Find the system's administrative tools--Data source ODBC---> Add Oracle Driver--Input datasource,username, select TNS Services name.
Two. Connecting to a database using oracleconnection occurs
-----------------
User Id=sajet; Password=tech;data source= (DESCRIPTION = (address_list= (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.66.225) (PORT = 1521)) (Connect_data = (service_name = Mes3nod)))
-----------------
"BadImageFormatException is raised when attempting to load the Oracle client library. This issue occurs if you are running in 64-bit mode with 32-bit Oracle client components installed "
Find the project solution--build and target platform--and choose the same version as your Oracle system. 64bite-->x86, 32bite-->x64
C # connecting Oracle Database Exception Summary