Subject: C# If test not working
Posted By: RichardOrmiston Post Date: 12/18/2005 1:23:29 PM
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";
            }    
                
      }


Go to topic 37717

Return to index page 414
Return to index page 413
Return to index page 412
Return to index page 411
Return to index page 410
Return to index page 409
Return to index page 408
Return to index page 407
Return to index page 406
Return to index page 405