Some stored procedures do some checks and when those fails, return a specific value. If nothing fails, some return a SELECT statement, some return NOTHING (like the sample below).
Note: Stored Procedures canNOT be changed at this point and the sample below is just a sample to show the RETURN and the SELECT differences.
/* THIS IS A SAMPLE PROC */
CREATE PROCEDURE [dbo].[Register]
(
@Email varchar(200)
)
AS
BEGIN
SET NOCOUNT ON ;
-- Check if user table has an Active record with this email
IF EXISTS(SELECT * FROM Users WHERE Email = @Email AND Activated = 0)
RETURN(1)
-- Check if user table has an Active record with this email
IF EXISTS(SELECT * FROM Users WHERE Email = @Email AND Activated = 1)
RETURN(2)
-- Create New User record
INSERT INTO Users (Email, xxx)
VALUES (@Email, xxxx)
END
Using EF5 and importing the stored procedures into the EDMX, how can I get the value 1 or 2 in case of problems or nothing in case the stored procedures went thru successfully?