Data room charging system-on/off

Source: Internet
Author: User

The logic is a bit confusing when I think about this part. After several days of computing, the basic implementation is as follows.

Procedure:

There are two types of dismounting process:

I. Normal disconnection

 

Ii. Force disconnection

 When the regular check balance is0Students are forced to go down.

Notes:

I. Time format. Because I useSql2005So the correct time format is very important.

2. Do not forget to set the basic data table and use the latest custom billing standard.

3. Always remember that you are a student managing rather than a computer. (Therefore, you only need to check the balance0, Force the machine to go off ).

4. The interval for regularly checking the balance. The interval attribute of the timer control can be set to any value between 0 and 65535. Therefore, the maximum interval for triggering an event with timer can only be 65 seconds. If you want to increase the time interval, you can use the followingCode. But remember that the maximum time interval cannot exceed the increasing time of your charges.

 
Dim dtnexttime as dateprivate sub form_load () timer1.interval = 500timer1. enabled = truedtnexttime = dateadd ("N", 2, now) end subprivate sub timer1_timer () if now> = dtnexttime thentimer1.enabled = false' add your code here dtnexttime = dateadd ("N", 2, now) timer1.enabled = trueend ifend sub

The dateadd function is used to calculate the future time (in this example, 2 minutes after the current time ).

the above is my idea of getting on and off the machine. The code is not very complicated and I will not write it here! As long as you figure out the logic, implementation is still not difficult!

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.