I've this code :
OracleConnection con = new OracleConnection("data source=localhost;user id=fastecit;password=fastecit");
con.Open(); string sql="Select userId from tblusers";
OracleCommand cmd = new OracleCommand(sql, con);
OracleDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{ messageBox.Show(dr[0].Tostring()); }
Same code in both projects,
in project1 "WinForm" Is Working correctly
in project2 "Excel 2007 addins" Following error appears:
ORA-12154: TNS:could not resolve the connect identifier specified
I'm using C#.net 2010 ,office 2007 , windows8, oracle 10g.
When preparing a manual connection to the database, as shown in the picture
Visual Studio, open View menu + Server Explorer.
Right mouse click on Data Connection + Add Connection + Select Oracle Database
server Name : localhost or name of my machine, set username & password and click on Test Connection, test is no succeeds.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…