Siva V

Siva V

  • NA
  • 118
  • 6.5k

Oracle connection with C#

Oct 17 2018 7:50 AM
Hi Guys,
 
I try to pull data from Oracle & bind my datasource. Below is my code snippet.
 
string sql =  "Select * from Employee Where EmpId = ':EmpId'";
OracleConnection con = new OracleConnection(connectionString);
OracleCommand cmd = new OracleCommand(sql, con); 
cmd.Parameters.Add(new OracleParameter("EmpId", "10");
OracleAdapter oDA = new OracleAdapter(cmd);
oDA.fill(ds);
 
I don't see any errors but results are not coming. but when i execute my query as follows i see results.
 
Select * from Employee Where EmpID = '10';     //I can see result 
 
Could you please let me know where It's going wrong.
 
Thanks 

Answers (4)