ExecuteScalar not returning value when there should be one

217 Views Asked by At

I am calling ExecuteScalar with a valid value, and it worked on my previous one. I'm using using Oracle.ManagedDataAccess.Client;. Yet in this call it is returning null when the value should be 'Q'. Here is the code:

cmd.Parameters.Add(new OracleParameter("Cbrtaxfilcd_Descr", cbrEmployers.Cbrtaxfilcd_Descr));
//cmd.CommandText = "select Code from CBR_TAX_FILING_CODES where DESCR = :Cbrtaxfilcd_Descr";
cmd.CommandText = "select Code from CBR_TAX_FILING_CODES where DESCR = 'Quarterly'";

try
{
    //should be a string
    cbrEmployers.Cbrtaxfilcd_Code = Convert.ToString(cmd.ExecuteScalar());
}
catch (Exception ex)
{
    var message = ex.Message;
    //todo
}
0

There are 0 best solutions below