0
Someone has already come across the following problem: When an error occurs that should be of the type Oracleexception, but in its place an exception is triggered, then the oracle treatment is not applied because of this (the "..." are suppressed implementations).
See example:
using (OracleConnection connection = new OracleConnection(ConfigurationManager.ConnectionStrings["Oracle"].ConnectionString))
using (OracleCommand command = connection.CreateCommand())
{
try
{
//connection.Open(); //PARA PROVOCAR ERRO ORACLE
(...)
//Captura resultado em um DataReader
//AO EXECUTAR ISTO NÃO LEVANTA ERRO ORACLE E SIM UM EXCEPTION SIMPLES.
using (Oracle.ManagedDataAccess.Client.OracleDataReader retornoBanco = command.ExecuteReader())
{
(...)
}
(...)
}
catch (OracleException oe)
{
(...)
switch (erroCodeOracle)
{
case 12571:
(...)
break;
default:
(...)
break;
}
}
}
Do not enter CATCH above! But the error that returns is "Connection is not open..."
Dear, I am using the Oracle client (using Oracle.ManagedDataAccess.Client). Thank you anyway...
– SantanaFire
Okay, I researched and edited my answer.
– Malkaviano
Dear, thank you again for your commitment. With your response I am determined to change my strategy and protect the code in another way, since I will not be able to treat this event as expected. I have already marked your review as a valid reply. Thanks again!
– SantanaFire
I understand your frustration, even though I don’t use Oracle I was frustrated with the documentation. I’m not even gonna tell you the quality of the code inside Assembly because I have nothing good to say. In my understanding the Oracleexception is used for errors from within the BD.
– Malkaviano