Hello,
will there will by any upgrade including the BindByName-functionality in CrLab for Oracle? I'm wondering if I should write my own code or if I simply have to call my parameters in the right order .
Thx, Alex
BindByName
-
- Posts: 23
- Joined: Fri 16 Nov 2007 20:10
- Location: Germany
BindByName
Hello Paul,
I'm using a direct connection to an Oracle 10g database.
In Oracles ODP.NET you can set a property "BindByName" of the command-object to true. Lets see an example. The following code is the beginning of a stored-procedure-definition in Oracle:
Now I will add the following code to my C#-project to call this procedure:
As you can see, I first call the WORKER_IN-parameter which is defined as the second parameter in Oracle-procudure. In Corelab this will leed to a mixup of parameters and values and even to an error if you have different parameter-types. If you use BindByName, the command-object will determine the correct order of parameter by itself.
I hope, I made it a little bit clearer. Did I?
Alex
I'm using a direct connection to an Oracle 10g database.
In Oracles ODP.NET you can set a property "BindByName" of the command-object to true. Lets see an example. The following code is the beginning of a stored-procedure-definition in Oracle:
Code: Select all
CREATE OR REPLACE PROCEDURE "USER"."SP_MY"
( CREATOR_IN IN NUMBER,
WORKER_IN IN NUMBER
...
Code: Select all
OracleCommand cmdThis = new OracleCommand("SP_MY", cnnMyConnection);
cmdThis.Parameters.Add(new OracleParameter("WORKER_IN", 13));
cmdThis.Parameters.Add(new OracleParameter("CREATOR_IN", 12));
// ODP.NET
// cmdThis.BindByName = true;
cmdThis.ExecuteNonQuery();
I hope, I made it a little bit clearer. Did I?
Alex
-
- Posts: 23
- Joined: Fri 16 Nov 2007 20:10
- Location: Germany