catching the database exceptions
I am about to start the design & development of a fairly big ASP.Net application with SQL Server 2000. There are many a number of entities, relationship between entities, constraints and complex data integrity rules.
I would like to depend on database features for ensuring data integrity. That is by using check constraints, unique constraints, foreign key constraints, triggers and the nullable property of fields, I will set all the data integrity rules in the database. I would like to avoid any explicit ASP.Net validations in aspx / cs / http handler files. Instead, I want to catch the db errors and show appropriate error messages. It should be possible to show appropriate error message (Not just showing "some error in the submitted data etc. etc.").
My doubt is, whether this is possible ? If yes, how can I do it ?
NB : Previously, I was checking all posted data with either validator controls or server side ASP.Net. This is very difficult and not maintainable also. Each validation change requires integrity rule changes at database level as well as code changes. I would like to get rid of script level data validations.
Thanks
Madhu
|