Reputation: 2793
I've added a Stored Procedure to my Store, which creates a Function Import in my Model, and I've set the Return Type to None, as the Stored Procedure merely does an Insert or Update.
Yet, the generated ObjectContext method returns an int, as opposed to void. When I execute this method, and it works, this value is -1.
What's going on here?
[EDIT]
the SPROC is simple and looks like this:
SET NOCOUNT ON
UPDATE Notes SET vchType = @Type, iPriority=5 WHERE iNoteNumber = @NoteID
Nothing should be returned, and if I execute into a variable, I'd think it'd be zero, like in SSMS:
DECLARE @return_value int
EXEC @return_value = [CNRD].[UpdateNoteType]
@NoteID = 12345,
@Type = N'REGULAR'
SELECT 'Return Value' = @return_value
------------------------------------------
[ Return Value ]
0
Here's how it's mapped:
Upvotes: 3
Views: 3865
Reputation: 11348
Non query method , see remarks here:
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executenonquery.aspx
For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command. When a trigger exists on a table being inserted or updated, the return value includes the number of rows affected by both the insert or update operation and the number of rows affected by the trigger or triggers. For all other types of statements, the return value is -1. If a rollback occurs, the return value is also -1.
Upvotes: 1