Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Checking for unique values
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01337135
Message ID:
01337281
Vues:
13
Well, I think that's the point. The constraint shouldn't be firing first because the business rule should be checked before the save. Which makes me think that the business rule is not doing what you want it (or need it) to do. Doing this in the test bench would tell you if the business rule is working. It is my guess that it is not.

I guess that you could still put the breakpoint in the business rule and see if it is working there from the app but I have always found setting up a quick and easy test bench to be informative and helpful in troubleshooting.

HTH

Bob

>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform