tags:

views:

154

answers:

1

Hello,

I'm trying to call an Oracle stored procedure. This procedure, has 2 input paramters (first is decimal, second is DateTime), the third is an output cursor.

I tried several code but no way, impossible to get data .... one parameter si missing (the output)

I tried this :

OracleConnection con = new OracleConnection();
con.ConnectionString = "....";
OracleCommand command = new OracleCommand("mypackage.myprocedure", con);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("param1", SqlDbType.Decimal).Value = 613;
command.Parameters.AddWithValue("param2", SqlDbType.DateTime).Value = mytime;

con.Open();
OracleDataAdapter adapter = new OracleDataAdapter(command);
DataSet ds = new DataSet();
adapter.Fill(ds);
con.Close();

Do you have an idea ?

Thanks,

+1  A: 

You need to set variable direction if you want it as output .

i.e.:

command.Parameters.Add("output", OracleType.Number).Direction = ParameterDirection.Output

read more here:

http://discuss.itacumens.com/index.php?topic=44798.0

Faruz