I have a try{} catch{}
block in my program in Visual Studio. In the try{}
block I have code to connect to a DB and when I run that program it returns an error. In this situation the program must execute the catch{}
block, but an error is returned from the try{}
block and the program stops.
try {
using (OracleConnection cn = new OracleConnection(DataBase.EDS_SDE_Connection)) {
cn.Open();
using (OracleCommand cm = cn.CreateCommand()) {
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "EDS_FEAUTRE_CLASSES.DIS_ENA_TRG_LOG";
OracleParameter oParam = new OracleParameter("PISDISABLE", OracleDbType.Decimal);
oParam.Direction = ParameterDirection.Input;
oParam.Value = pIsDisable;
cm.Parameters.Add(oParam);
cm.ExecuteNonQuery();
}
}
bRet = true;
} catch (Exception ex) {
ClsShares.ShowMessage("", ex.Message);
bRet = false;
}
That's was from bellow highlighted chekbox: