Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stored Procedure Failed Not Caught by MM.NET
Message
 
 
To
12/03/2009 23:25:59
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
C# 3.0
OS:
Vista
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01387586
Message ID:
01387587
Views:
65
It's a nice way to generate bug free application :))

>Hi folks!
>
>I've a horror story to share, maybe there's somebody who can shed some light.
>
>The Problem: When using SaveEntity, if the associated SP fails, the BO does not report any errors, as a matter of fact continues as if everything went ok.
>
>The Result: The user thinks the record was saved, but in reality it wasn't because the SP failed.....(screaming!)
>
>The aftermath: since I'm using AutoUseTransaction = false, after the saveentity is invoked, when trying to add new entity I get another error because the existing entity did not get "clean".
>
>In other words, the BO doesn't seem to catch the ADO notification that the SP failed.
>
>You may ask at this point, but how did you know that the SP failed if the BO did not report any errors?
>
>Well, I realized of this because the SP in question was failing when trying to insert a DBNull value to a column of type varbinary(MAX), which I solved by following this link
>http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/e61f0616-0866-4f3f-aeba-6a76e144e169/
>
>Then, who knows why, maybe it is the pessimist I carry in the bottom of my soul, I typed RAISERROR at the beginning of the SP. Boom.
>
>As additional info, I've tried the following:
>
>(1) I've forced an error on the SP by adding a RAISEERROR at the beginning of it,
>(2) built a couple of test on NUnit with different BOs of my app all trying to use saveentity or insert with SPs that have the raiserror line: all of them with the same results (Basically the saveentity method executes fine, but the data obviously does not get saved because of (1),
>(3) I've built separate methods using plain ADO.NET code against the same SP (same Nunit session) and in this case the error comes up, so this tells me it is not an ADO.NET bug.
>
>Any ideas? Is this a mm.net bug or is this a feature? <vbg>
>
>TIA
>Sleepless in DC.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform