-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: SitaramanM
Message 5 in Discussion

Hi   As to your question , how to catch the exception, you can use the methods 
specified by sayad/vishnu/kalyan.  But  there is a basic design problem in the way you 
want to handle.  Do note that there is a difference between the term "error" and the 
term "exception".   Errors include business errors, as is in your case and should be 
handled proactively rather than handled as exception.     Exception as the name 
implies  are  "Exception"al situations,  wherein you do not have control of the 
(mis)behaviour of the app at runtime and you want to handle such situations and exit 
gracefully.  Examples could be reading a file that the user has deleted/connection to 
a DB Server which is not yet started etc.  Exception Handling is for such situations.  
   However, situations like Duplicate Data check etc should NOT be handled using 
exceptions.  Throwing an Exception is a expensive affair and should not be treated as 
an alternative for routine (business)error handling.    In your situation, i would 
recommend that you start a transaction, check whether thedata that you are trying to 
insert is already existing using a select count(*),  and if it returns 0 then insert 
the new record.  This way, you might end up writing a few extra lines of code.  But 
this is the right way to do it, rather than having global/local exception handlers for 
business errors     hth   regards,   sr

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to