I'm making a hotel booking system, and I want to make a background color change in my button(dependin g on the date)
When the date value in database is equals to today the color should be red.. but if its not today the background color should be yellow but if its not being booked it should be Green..
I'm using this code:
The yellow color will run but the red color won't activate... am I missing something?
When the date value in database is equals to today the color should be red.. but if its not today the background color should be yellow but if its not being booked it should be Green..
I'm using this code:
Code:
while (dr.Read())
{
DateTime now = DateTime.Today;
now = Convert.ToDateTime(datetoday.Value);
DateTime a = Convert.ToDateTime(dr[1]);
if (a != now && a == now)
{
room1.BackColor = Color.Red;
}
if (a != now)
{
room1.BackColor = Color.Yellow;
}
if (a == now)
{
room1.BackColor = Color.Red;
}
}
dr.Close();
Comment