Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on C#,.net application using Oracle database.how to execute update queries without using tsanames.ora through C#.

For Ref#. following is my code
C#
OracleConnection objConn = new OracleConnection();

string strQuery = "Update emp set Name = 'xxx' where Id='1000'";
           
objConn.ConnectionString = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xxxxx)(PORT=1521))(CONNECT_DATA=(SID=xxxx)));User Id=xxx;Password=xxxxx;"
           
objConn.Open();
objCommand = new OracleCommand(strQuery, objConn);


if (objConn.State == ConnectionState.Open)
{
    objCommand.ExecuteNonQuery()
}

Connection is successfully gets open. but it's get stuck on objCommand.ExecuteNonQuery()/objCommand.ExecuteScalar() line. I have added code in try catch block but it's not throwing any error and execution stucks on this line.
Posted
Updated 20-Nov-15 2:40am
v2

1 solution

You have to wait for the command execution to time out before it's going to throw an error. Since this is such a short query chances are it's a problem with your connection string.

Go to http://connectionstrings.com[^] to do some research on the proper connection string for your situation.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900