Enzo D'Andrea
Enzo D'Andrea

Reputation: 1

EF 6.1 T-SQL RETURN WRONG RESULT (SQL SERVER 2012)

I have the following Store Procedure:

CREATE PROCEDURE [SP_DELETE_ASSEMBLY] 
@FullAssemblyName nvarchar(300)
AS 
SET NOCOUNT ON;

IF (@FullAssemblyName IS NULL) OR (LEN(@FullAssemblyName) = 0)
    RETURN -10

IF EXISTS (SELECT 1 FROM [TB_DYNAMICASSEMBLIES] WHERE [FullAssemblyName] = @FullAssemblyName)
BEGIN

    DELETE FROM [TB_DYNAMICASSEMBLIES]
    WHERE [FullAssemblyName] = @FullAssemblyName
END
ELSE
BEGIN
    RETURN -10
END

RETURN 10

GO

I'm using EF 6.1 by using this call to the store procedure:

return entities.SP_DELETE_ASSEMBLY(assemblyName);

However I call the store procedure I always get -1 as return.

What is wrong?

Upvotes: 0

Views: 79

Answers (1)

JamieA
JamieA

Reputation: 2013

See this answer

Get return value from stored procedure

You can achieve this using an output parameter

Upvotes: 1

Related Questions