Author: ptcoder | Posted on: 3/29/2009 6:48:59 PM | Views : 339

I am writing all of my exception handling in my pages and at each catch block I am calling the same code. So for each ExecuteReader() in my catch statement I have the same code for every page. It makes sense to put that code in the app_code folder to be accessed by all the pages. I know how to use the app_code folder and I can successfully call a method from there, but my question is how do I pass the SqlException result to that method? I am setting the SqlException result to "ex" so how can I pass ex to that method? The logError() method does not seem to know what "ex" is.  I may be going about this all wrong, but this seems like the simplest way of handling this. See my code below:

try

{

readerCheckExists = cmdCheckExists.ExecuteReader();

readerCheckExists.Read() ...

Go to the complete details ...