Hi,
We have SQL: update tmp t set t.f1 = t.f1+1 where t.f2=:p_f2 returning t.f1 into :p_f1
In ODP.Net, It is OK when we add parameter like this:
- cmd.Parameters.Add("p1"...).Value = 10;
- cmd.Parameters.Add("p2"...).Direction = ....ReturnValue;
But in DotConnect (5.2) we get ORA-01036 error. So that we have to add parameter with exact name:
- cmd.Parameters.Add("p_f2"...).Value = 10;
- cmd.Parameters.Add("p_f1"...).Direction = ....ReturnValue;
I think that, DotConnect check the binding name! For us, names is not important but positions!
How can we use the old way like in ODP.Net?
We are using VS2005 SP1
How to Bind Parameter by Position not by Name
Please refer to http://www.devart.com/dotconnect/oracle ... eters.html:
"Parameters [in the query] require accordance with names of OracleParameter instances in the collection [OracleCommand.Parameters]."
"Parameters [in the query] require accordance with names of OracleParameter instances in the collection [OracleCommand.Parameters]."
As a workaround, you can use the OracleCommand.ParametersCheck property (refer to the mentioned article) to synchronize automatically query text and OracleCommand.Parameters collection. After this you can work with parameters via their indexes (not names):
Code: Select all
var cmd = new OracleCommand(...);
cmd.CommandText = "update tmp t set t.f1 = t.f1+1 where t.f2=:p_f2 returning t.f1 into :p_f1";
cmd.ParameterCheck = true;
cmd.Parameters[0].Value = 10;
cmd.Parameters[1].Direction = ....ReturnValue;
...