I have an if/else statement that is not working.
while (rdr.Read())
{
string permission = rdr["Permission"].ToString();
if (permission == "Exec")
{
Run my code
}
else
{
lblErrorStart.Visible = true;
}
}
If Permission does equal Exec then everything works fine but (when stepping through the code) I have noticed that when Permission does not equal Exec, it does not trigger the Else. It just goes back to the while statement and stops. Let me know if I need to provide any more code.
Note: I only have Exec in the database. Everything else is null.