C# If test not working
I'm trying to do an if test to disply a message if a record value in a db is less than 3, but it displays the message always, see code below. Also I'm looking for some sample code of a comboBox in C#, I want to populate the combox using a stored procedure, any examples appreciated.
SqlDataAdapter da = new SqlDataAdapter
("SELECT MAX(FeedbackId) as FeedbackId, ComfortLevel from Feedbacks GROUP BY FeedbackId, ComfortLevel", StrConnection);
DataSet ds = new DataSet();
da.Fill(ds,"Feedbacks");
foreach (DataRow dr in ds.Tables["Feedbacks"].Rows)
{
int id = (int)dr["ComfortLevel"];
if (id == 3)
{
message2.Text = "Contact a tutor";
}
}
|