Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Checking for unique values
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01337135
Message ID:
01337271
Views:
21
Bob,
Thanks but I don't think the object test bench will help me here since I'm never reaching the business rule object at all. The SQL constraint is firing first.

>Linda,
>
>Tim has you on the right track. The business rules is definitely where this belongs. I have this working well for alternate keys in my database app in many places.
>
>One other suggestion is to test this in the object test bench, without the noise of your interface. If the business rule works there and prohibits the save, then you know the business rule works. If it doesn't work, then get it to work there before trying it again in your interface app.
>
>Bob
>
>>Bob,
>>Thanks. I had, in fact already checked this thread and that's basically what I tried. The problem is that I have a uniqueness constraint on the index in SQL Server and that is firing before the rules ever get checked in the business object.
>>
>>>Linda,
>>>
>>>Check this thread for this: Catching errors from the data Layer Thread #1329723 Message #1329723
>>>
>>>
>>>>I have a uniqueness constraint on my SQL Server table. I want to check for uniqueness in a rule before getting an error in SQL Server. I added a rule in the rule class. However, the SQL error is triggering before the rule code is ever run.
>>>>
>>>>I tried to put this code in the HookPreSave method but it wouldn't let me call the mmAppDeskTop.FormMgr.Show() method, so I'm not sure how to tell the user what the problem is. Would I just add a broken rule from here?
>>>>
>>>>Then I tried the Validating method of the text box but I don't see a way to indicate that the value is not valid. For now, I have just forced the value to blank so it will get trapped by the test for blank id's but that's not a great solution.
>>>>
>>>>What's the best way to handle this? Thanks.
Linda Harmes
HiBit Technologies, Inc.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform