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!