Click here to Skip to main content
15,122,406 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi All!
I know Builder C++ and Delphi have Oracle components(TOracleDataSet for example) which have Substitution type. How can I get it in C#?
I tried to do this:

private string query = "select * from tb_zone t where t.employee=:p1 :p2 ";
       public void test()
           using (OracleConnection connection = new OracleConnection(connectionString))
               OracleCommand cmd = new OracleCommand(query, connection);
               cmd.Parameters.AddWithValue("p1", 8434);
               cmd.Parameters.AddWithValue("p2", " and t.rkc is not null "); 
               MessageBox.Show( cmd.ExecuteOracleScalar().ToString());

But it doesn't work!
I think the query becomes like below :
select * from tb_zone t where t.employee=8434 " and t.rkc is not null "
The second parameter wrapped by quotes.
Sorry for my English :)
Updated 7-Jun-11 14:04pm

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