I believe your question is "How do I trap the Script Timeout error and record it in the database". Then the answer is you can't do it with On error resume next.
The problem is that ASP has determined your script has run for too long. In order for your code to trap and record the error your code needs to continue but that is exactly what ASP has determined shouldn't happen since its time is up.
Also in general unless you can continue to do something sensible (and that does not include logging) in your script there is no point trying to use On Error Resume Next to trap the error.
Instead create a new ASP script that should run whenever you get a script error (this will include a Script timeout error). In IIS manager open your applications property dialog and select the Custom Errors tab. Edit the handler for the 500;100 HTTP error and change it to URL and the path of this ASP script.
Now you can place your error logging code in this ASP script. You can access the error thrown by the failing ASP page by accessing the Server.GetLastError method. You can also configure this page to send something friendly to the user.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…