Stored procedure with output parameters in linq to oracle
Stored procedure with output parameters in linq to oracle
Hello,
I am building a asp.net /C# webapplication with oracle as underlaying database. I use linq to oracle to access de oracle db. The whole application is making use of exsisting stored procedures with input and output parameters. My experiance with oracle is zero. So now my question is how to deal with these output parameters.
My sp has 29 parameters consisting of input and output parameters
string i_inputParameter, ref object o_OutputParameter.
When i use linq to oracle i have to set all 29 parameters and cannot set only the input parameters because it expects all 29. So how can i do this?
i use context.MyOracleStoredProcedure(i_inputparameter, o_outputparameter);
Thanx in atvance
Talsja
I am building a asp.net /C# webapplication with oracle as underlaying database. I use linq to oracle to access de oracle db. The whole application is making use of exsisting stored procedures with input and output parameters. My experiance with oracle is zero. So now my question is how to deal with these output parameters.
My sp has 29 parameters consisting of input and output parameters
string i_inputParameter, ref object o_OutputParameter.
When i use linq to oracle i have to set all 29 parameters and cannot set only the input parameters because it expects all 29. So how can i do this?
i use context.MyOracleStoredProcedure(i_inputparameter, o_outputparameter);
Thanx in atvance
Talsja
If you need the values of out parameters, you'll at least have to pass into the generated method some empty parameters to obtain the values in.
In case you don't need the values of out parameters, you can write a wrapper method in the Datacontext.cs file calling the generated method with the set of input parameters only (inside the wrapper you can call the generated method with dummy out parameters).
In case you don't need the values of out parameters, you can write a wrapper method in the Datacontext.cs file calling the generated method with the set of input parameters only (inside the wrapper you can call the generated method with dummy out parameters).
Let you have int outpar1 and object outpar2.
The simplest way is to execute something like this:
After the procedure is called, the variables outpar1 and outpar2 contain the values of out parameters.
The simplest way is to execute something like this:
Code: Select all
{
int outpar1 = null;
object outpar2 = null;
var myquery = context.myStoredProcedure(PersonID, PersonName, ref outpar1, ref outpar2);
}
Code: Select all
Dim fi As New FIEntities()
Dim outpar As Object = Nothing
Dim p = fi.AssocRead(outpar)
Dim j As ASSOCIATE = p.FirstOrDefault()