Hi mansoorkpy,
In this way you can check the current DateTime with Database record.
// Get the DateTime from Database.
DateTime dbTime = new DateTime(2023, 10, 10, 16, 30, 05);
if (DateTime.Now >= Convert.ToDateTime("10AM") && DateTime.Now <= dbTime)
{
btnConnect.Enabled = false;
}
else
{
btnConnect.Enabled = true;
}