[Solved] Booking System Using C# winform [closed]


You’ll need to establish a connection to your database using a SQLConnection object or the appropriate class depending on your database.

For instance:

bool isReserved;
using (SqlConnection connection = new SqlConnection(connectionString)
using (SqlCommand command = new SqlCommand("SELECT isReserved FROM YourTable WHERE BookingId = 1", connection))
{
    connection.Open();  
    using (SqlDataReader reader = command.ExecuteReader())
    {
        while (reader.Read())
        {
            isReserved = (bool)reader["isReserved"];
        }
    }
}

You can then use the BackColor property.

if (isReserved) {
    Button1.BackColor = Color.Red; 
}

solved Booking System Using C# winform [closed]