ODAC: Object reference not set to an instance of an object
Please make sure reference are correct and Oracle.DataAccess.dll is of correct version.
Please follow below steps. It worked for me.
Locate and copy the oraons.dll file in ‘<>product\12.2.0\client_1’ on your oracle install path
Paste the file into the ‘<>product\12.2.0\client_1\bin directory
Try calling the code again.
please try this solution :
string connString = "User Id=SYSTEM;Password=manager;Data Source=(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.1.22)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = XE)))";OracleConnection conn = new OracleConnection();conn.ConnectionString = connString;conn.Open();
For more informations : Oracle Connection in C# - connection string
OracleConnection Uses Oracle.DataAccess DLL (Its deprecated, read about ODP.net)
You probably have to install oracle client 11g to provide the neccessery DLL.A few points:
- Make sure that tns is configure correctly
- install the ora client by your build settings (32/64 bit)
- Make sure you add the DLL reference to your solution.