Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Catching errors from the data Layer
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
C# 3.0
Database:
MySQL
Miscellaneous
Thread ID:
01329723
Message ID:
01329824
Views:
18
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform