I have a .NET web application that frequently executes queries to get data from a local database. 

In situations where the query doesn't run (due to an exception) or the query returns an unexpected set of data (such as an empty set). I want to be able to rebuild the query (replacing it's @parameters with the values actually used) and store the complete query in the database along with the exception. 

I'm aware that I can do this through standard code but I was wondering whether it would be safer to do via Elmah? 

Also would doing this via Elmah give me the ability to be able to view the executed sql through elmah.axd (when access is enabled)?