I have some logic that is supposed to read whether a column in a database is supposed to be 1 or 0, representing true or false.
I've gone through it with the debugger and the if statement evaluates to true, so surely that would mean that the checkbox should appear to be checked?
int QuestionID = Convert.ToInt32(ddQuestions.SelectedItem.Text);
using (SqlDataReader dr = SQLData.checkchkbx(QuestionID))
{
if (dr.HasRows)
{
while (dr.Read())
{
string TRUEorFALSE = dr["TRUEorFALSE"].ToString();
int trueorfalse = Convert.ToInt32(TRUEorFALSE);
if (trueorfalse == 1)
{
chkbxAnswer1.Checked=true;
}
}
}
}
Am I missing something here?
Aucun commentaire:
Enregistrer un commentaire