Running query below is successfully shows the returned results;
sp_wts_lst_mod_amp_mtx 'xxxx', '062306', 'LS-I', 'EA', null
So I'm correctly passing the same values as parameters to below method but it is returning empty. reader.Read() is false.
What is wrong in my method?
public static List<string> GetMatrices(object userMarketId, string userMarketLabelId, string model, string amp)
{
var matrices = new List<string>();
var connection = new OdbcConnection();
try
{
using (connection = clsWTSCommon.GetDBConnection(userMarketId, null))
using (var command = connection.CreateCommand())
{
command.CommandText = "{CALL " + StoreProcedures.SpWtsLstModAmpMtx + " (?,?,?,?,?)}";
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("@ctl_mkt_id", OdbcType.NVarChar, 10).Value = userMarketId.ToString();
command.Parameters.Add("@ctl_mkt_lbl_id", OdbcType.NVarChar, 10).Value = userMarketLabelId;
command.Parameters.Add("@model_code", OdbcType.NVarChar, 16).Value = model;
command.Parameters.Add("@amp_code", OdbcType.NVarChar, 3).Value = amp;
command.Parameters.Add("@language_id", OdbcType.NVarChar, 3).Value = null;
if (connection.State == ConnectionState.Open)
{
var reader = command.ExecuteReader();
while (reader.Read())
{
matrices.Add(reader.GetString(reader.GetOrdinal("sspl")) + "/" +
reader.GetString(reader.GetOrdinal("peak_gain")));
}
}
}
}
catch (Exception ex)
{
clsDataAccess.ShowInfo(ex.Message);
}
finally
{
connection.Close();
connection.Dispose();
}
return matrices;
}