C# - Run Oracle Procedure and then select from the created session table

Asked

Viewed 260 times

2

Hello, I’m trying to do the following. I have a database that performs a select and inserts the data into a table that only exists in that session. I need to run this trial and then refer to the table that she recorded the records.

The command used is as follows::

--Executo a procedure
Exec sp_procedure(Parametros);

--Consulto Procedure
Select * from tb_resultado_procedure

When I perform this group of commands in sqlDeveloper works normally and brings back the return but when I run in C# when performing the table it comes empty.

Follows code used in C#.

oraCON = new OracleConnection(Stringconexao);
OracleCommand cmd = new OracleCommand();
cmd.Connection = oraCON;
oraCON.Open(); 

cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "sp_procedure";

cmd.Parameters.Add("parametro", OracleType.VarChar).Value = "Valor";
cmd.ExecuteNonQuery();

cmd.Parameters.Clear();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select * from tb_resultado_procedure;";

OracleDataAdapter orada = new OracleDataAdapter(cmd);
orada.Fill(dsoPN, "resul");

grdResultado.DataSource = dsoPN;

grdResultado.Refresh();

oraCON.Close();

Procedure runs normal but the table comes with empty data in C# while in Sqldeveloper it is filled.

How to run the trial and then refer to the table in C#?

1 answer

0


Browser other questions tagged

You are not signed in. Login or sign up in order to post.