Posted on: 11/16/2012 1:37:39 AM | Views : 325

Hallo all,
I want to trap an error and throw a custom error. By this I mean that in my Data Access Layer which is a static class at present I access the database with a try...catch...finally construct. What I want is that a subroutine in my DAL should throw an error back to the calling routine which can then be used to display an error to the end user but I do not want to throw the SQL Server error, instead I want to trap this. I have tried the following:
Try conn.Open() cmd.ExecuteNonQuery() Catch ex As Exception ErrorHandler.HandleException(ex) Throw New ApplicationException("There was a problem recording the changes to the database.")
Return
 Finally conn.Close() cmd.Dispose() conn.Dispose() End Try Where ErrorHandler is a module I have for handling errors and recording them so I can view them later. The proble ...

Go to the complete details ...