0
votes

How to capture the last executed sql statement on a classic asp website.

My classic asp website is on windows 2008 and sql 2008

i'm handling errors using server.transfer to an asp page 500.asp

i'm able to transfer the connection object from the page that caused the error

This is an old website. The connection is in an include file. So i added session to it.

I dont want to open all the asp files and store teh sql statement in a session variable to be available in the 500.asp page.

is there any other simpler way to find out last executed sql statement. I'm on a shared hosting. so cannot use fn_get_sql or sys.[dm_exec_connections]

1

1 Answers

0
votes

Is the purpose for error tracking or something else? I check for errors after every call to the database and if error then I send err.description along with the SQL string to a page that handles errors and even emails me (the admin) the details of any errors.

If your purpose for saving SQL strings is not to do with errors, and you don't want to use a session variable then you could have a database table where you store those errors by date & time.