Copy Code code as follows:
public static void Clearcountbytime ()
{
System.Timers.Timer Atimer = new System.Timers.Timer ();
atimer.elapsed + = new Elapsedeventhandler (timeevent);
Set the time interval for raising time here set to 1 seconds
Atimer.interval = 1000;
Atimer.enabled = true;
}
private static void Timeevent (object source, Elapsedeventargs e)
{
Get hour minute second start executing if it equals a value
int inthour = E.signaltime.hour;
int intminute = E.signaltime.minute;
int intsecond = E.signaltime.second;
Custom time, executed at 00:00:00
int ihour = 00;
int iminute = 00;
int isecond = 00;
Set up a daily 00:00:00 start execution program
if (Inthour = ihour && intminute = iminute && intsecond = isecond)
{
Clearcount ();
}
}
public static void Clearcount ()
{
String sql = "Stored procedure to execute";
int result=sqlhelper.executenonquery (commandtype.storedprocedure, SQL);
if (Result > 0)
{
Todaycount Qing 0 success!;
}
Else
{
Todaycount Qing 0 failed!;
}
}