I have a function GetAlertData()
that returns a Datatable. I invoke it as:
var dt = GetAlertData()
Behavior in debug mode:
Case 1: When I do F11 all the time and go into the GetAlertData function, all works well and I get the correct table
Case 2: When I do F10 on this function and step over it, GetAlertData returns a table with all values filled as zero (incorrect). (Columns of my table are all float datatype)
In release mode, behavior is same as pressing F10 in debug mode, i.e again I get all zeros.
Any ideas on what could be the reason, or what I can try to find the reason? Thanks..
Edit: my GetAlertData function is something like this..
internal static DataSet GetAlertData()
{
using (var sqlConnection = new SqlConnection(Constants.ConnectionString))
{
const string sproc = @"[spo_GetAlertData]";
var cmd = new SqlCommand(sproc, sqlConnection) {CommandType = CommandType.StoredProcedure};
cmd.Parameters.Add("@TimeWindow", SqlDbType.Int);
cmd.Parameters["@TimeWindow"].Value =2
cmd.Parameters.Add("@ThresholdTime", SqlDbType.Int);
cmd.Parameters["@ThresholdTime"].Value = 2
var dsAnalysis = new DataSet();
var da = new SqlDataAdapter(cmd);
da.Fill(dsAnalysis);
if (dsAnalysis.Tables.Count > 0 && dsAnalysis.Tables[0].Rows.Count > 0)
return dsAnalysis;
return null;
}
}