0
I am developing a WEBAPI in c# that runs a precedent on Oracle and after this procedure, it queries a table. This precedent only deletes data from a time table and inserts the the data informed in it and then displays them with some more information. When I run directly on Oracle, it works: (run Minha_procedure(KEY, YEAR, MONTH)). BS: She has a cursor. But in my code is not running, It follows below my method:
public void ExecutarProcedure(string chave, string mes, string ano)
{
OpenConnection();
OracleCommand cmd = new OracleCommand("BDRH_APPS.SP_CARGA_SITE", Con);
cmd.CommandType = System.Data.CommandType.StoredProcedure;
OracleDataAdapter da = new OracleDataAdapter();
cmd.Parameters.Add("CHAVE_PAR", chave);
cmd.Parameters.Add("ANOFOLHA_PAR",ano );
cmd.Parameters.Add("MESFOLHA_PAR",mes );
// execute the command to open the ref cursors
cmd.ExecuteNonQuery();
cmd.Dispose();
CloseConnection();
}
Thank you!
And what’s the mistake?
– Bruno Warmling
no error, simply not giving the run in the database
– Rafael Veloso
Oraclecommand has been deprecated. http://go.microsoft.com/fwlink/? Linkid=144260
– Leandro Angelo
But the problem seems to be in connection management, which makes the method
OpenConnection();
and where the attribute comes fromCon
?– Leandro Angelo
If not from the bug but also not "run", it may be that commit is missing. Hard to say...
– Bruno Warmling
Leandro, this class inherits from another connection class with the protected database Oracleconnection Con; //Connection to the database.. protected Oraclecommand Cmd; //Execute SQL commands.. protected Oracledatareader Dr; //Read query data.. protected Oracletransaction Tr; //transactions (commit/rollback)
– Rafael Veloso
without seeing these others there is no help, but still think you are not running the command on the open connection... submit a [MCVE]
– Leandro Angelo