ASP.net Daily Task _ Practical skills

Source: Internet
Author: User
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!;
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.