The Artima Developer Community
Sponsored Link

Design Forum
Handling Database CRUD events

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
M SD

Posts: 1
Nickname: iceshock
Registered: Dec, 2006

Handling Database CRUD events Posted: Dec 11, 2006 2:54 AM
Reply to this message Reply
Advertisement
I am an ASP.NET Developer. I am working on a project where I need to manage Creation, Update and Deletion of records. I need to know what would be the best practice to handle the following issues:
- When Inserting a record, there are constraints to prevent insertion 2 items having the same code for example. So what would be the best way to prevent that: Add unique Constraints at the Database level and handle exceptions in my application code? If so, the exception itself is not informative enough unless I dig into the exception message, meaning there is not a unique exception for every different constraint violation.
Would it be better if I check in my stored procedures before attempting to insert, and return a flag indicating why an insertion fails?

-When Deleting a record, the same thing concerning Foreign keys, where to handle the violation, on the database or in my application code?

Thanks for any help.

Topic: Crack the Code Previous Topic   Next Topic Topic: Templates Designs

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use