SQL Server - report the error back to .NET.

I am using Entity Framework with stored procedures to insert / update / delete objects.

The task I am doing is managing stocks using the FIFO / LIFO => methods that those inserts / updates / deletes perform several checks and may fail (sometimes they fail).

The problem is that I want to tell .NET what went wrong and why. How can i do this?

I am currently using something like this:

BEGIN --rollback
ROLLBACK TRAN
RAISERROR (N'There' not enough items in stock.', -- message
    16, -- severity
    1) -- state
END;

I always get an "MSDTC error" - "Source provider refused EnlistTransaction."

+5
source share
2 answers

I don’t think it is that far. Error starting one of the transactions, your user error does not occur.

+1

InnerException, , .

0

All Articles