The following Database connection code is working in one project but not for other.
Both
- Reside in the same folder
- Accessing the same Oracle.dataaccess dll
I am unable to understand what might have led the other project not connect to oracle DB.
I am out of ideas on how to make this project use the connection strings in the tnsnames.ora.
Any help is appreciated
Code:
string constr = "Data Source=Dev11G;User Id=Username;Password=pwd;";
OracleConnection con = new OracleConnection(constr);
con.Open();
OracleCommand cmd = new OracleCommand("Select * from Table", con);
cmd.CommandType = CommandType.Text;
DataTable dt = new DataTable();
using (OracleDataAdapter da = new OracleDataAdapter())
{
da.SelectCommand = cmd;
da.Fill(dt);
}
Error being Recieved: ORA-12154:TNS:could not resolve the connect identifier specified
Error occuring at: con.Open();