PaulHInstincticve
Programmer
I need to help to implement an error handler in ASP that will be able to identify and close open database resources - can anybody help?
My background is Microsoft Visual FoxPro programming for the Windows desktop, however, I have a small application written in ASP on a website that uses databases also (these are FoxPro but that is irrelevant here). I have hit a problem from time to time where the ISP has been on my back for leaving databases open which has been putting a strain on the shared server. Obviously I know that all resources opened should be closed before the script ends in order to avoid this and I am doing this correctly. What is happening, however, is that from time to time databases are being corrupted by the daily FTP upload process rather than ASP activity and as a result the script crashes when it tries to open a corrupt table and therefore never reaches the end of the script in order to close other open databases.
What I need is an error handler similar to what I write in Visual FoxPro for my desktop apps that would run in ASP on the web to perform the following
- activate a common routine that would be run if an ASP error is detected on ANY script in the application
- report that error on screen to the user including script name and line number responsible
- identify and close all open database resources keeping in mind that the error handler is unlikely to know which databases will have been opened by which scripts
- email a report of the error to myself so that I know there is a problem usually before the client does
I suspect I won't have too much difficulty with most of this except for the 3rd item to identify which database resources are open in order to close them. Can anybody help with this? Thanks
Paul
My background is Microsoft Visual FoxPro programming for the Windows desktop, however, I have a small application written in ASP on a website that uses databases also (these are FoxPro but that is irrelevant here). I have hit a problem from time to time where the ISP has been on my back for leaving databases open which has been putting a strain on the shared server. Obviously I know that all resources opened should be closed before the script ends in order to avoid this and I am doing this correctly. What is happening, however, is that from time to time databases are being corrupted by the daily FTP upload process rather than ASP activity and as a result the script crashes when it tries to open a corrupt table and therefore never reaches the end of the script in order to close other open databases.
What I need is an error handler similar to what I write in Visual FoxPro for my desktop apps that would run in ASP on the web to perform the following
- activate a common routine that would be run if an ASP error is detected on ANY script in the application
- report that error on screen to the user including script name and line number responsible
- identify and close all open database resources keeping in mind that the error handler is unlikely to know which databases will have been opened by which scripts
- email a report of the error to myself so that I know there is a problem usually before the client does
I suspect I won't have too much difficulty with most of this except for the 3rd item to identify which database resources are open in order to close them. Can anybody help with this? Thanks
Paul