The problem with that approach is that the reminder time has to be accurate: to the microsecond or the comparison will fail.
Instead of looking for equality, add a column to your DB which indicates that a reminder has been issued and acknowledged. Then change your SQL SELECT to only return "unused" reminders.
And move the usage of the SqlReader inside the loop!
Then, change your comparison code to:
try
{
conn.Open();
using (SqlCeCommand command = new SqlCeCommand(query, conn))
{
r = command.ExecuteReader();
DateTime now = DateTime.Now;
while (r.Read())
{
DateTime tag = r.GetDateTime(0);
if (tag <= now)
}
MessageBox.Show("You have a reminder at this moment");
}
}
}
conn.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}