Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Catching errors from the data Layer
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
C# 3.0
Database:
MySQL
Divers
Thread ID:
01329723
Message ID:
01329824
Vues:
19
Stuart,

>I have a table that does not allow duplicate records, if I try and enter a duplicate record how do I catch the error and error message?

There are a few ways to handle this. First of all, you can create a business rule that does the check for a duplicate before the data gets saved. That way, the exception never occurs. For details on implementing this approach, check out the MM .NET Dev Guide topic “Checking for Unique Values”.
Other than that, if you want to catch this exception, you an override your business object’s HandleException method and put code in this method that handles the exception and adds a broken rule to the business rule object.

Best Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform