Because the application variable typically stores information that is shared by all users connected to the server (as in the program, "Global Variables"),
Because it is a global variable, it is easy to have two or more users at the same time to operate this variable to create a conflict, and Application.Lock and Application.UnLock is to solve the problem,
Using lock ensures that only one of the users connected to the server during a certain period of time can gain access to or modify the application variable (that is, locking the public variable). Any other user who wants to obtain such permission must wait for the current user to end their lock or the current ASP program terminates execution.
The current ASP program termination execution cannot be unlocked, only the site restarts, so the program must be guaranteed to unlock as soon as possible, especially in the middle of the execution of the statement may be wrong to pay more attention to
Application.Lock
EXECUTE statement
Application.UnLock
There was a strong man like this to pontificate! That's strong!!!
Application.Lock ... The role of Application.UnLock is like a "public toilet", each toilet door will have a lock, because the toilet is common, so that when you use, the toilet door to lock (Application.Lock), in order to use when you do not let others rushed in. When you're done, you'll have to open the lock (Application.UnLock) so that others can use it.
About Application.Lock ... What role does Application.UnLock have?