Prasad Bhagat

Prasad Bhagat

  • NA
  • 516
  • 234.3k

return output values from a stored procedure using EF?

Sep 21 2015 9:28 AM
Dear All,
 
 
How to retreve output values from procedure using Entityfremework ..have look on bellow code please
 
CREATE PROCEDURE [dbo].[DeleteFriend]
@FriendDeviceId VARCHAR(Max),
@DeviceId VARCHAR(Max)
AS
BEGIN
BEGIN TRY
DELETE FROM Friends
WHERE DeviceId = @DeviceId AND FriendDeviceId = @FriendDeviceId
DELETE FROM Friends
WHERE DeviceId = @FriendDeviceId AND FriendDeviceId = @DeviceId
DECLARE @NotificationMsg VARCHAR(MAX)
SET @NotificationMsg = ''
DECLARE @Name VARCHAR(100)
DECLARE @FriendRegistrationId VARCHAR(MAX)
DECLARE @FriendOS VARCHAR(20)
SELECT @Name = Name
FROM DeviceMaster
WHERE DeviceId = @DeviceId
SET @NotificationMsg = @Name + ' has deleted you from the group'
SELECT @FriendRegistrationId = RegistrationId,
@FriendOS = OS
FROM dbo.DeviceMaster
WHERE DeviceId = @FriendDeviceId
SELECT @NotificationMsg AS STATUSMSG, 1 AS STATUSIND, @FriendRegistrationId AS FriendRegistrationId, @FriendOS AS OS
--EXEC GetFriendsList @DeviceId
END TRY
BEGIN CATCH
SELECT ERROR_MESSAGE() AS STATUSMSG, -1 AS STATUSIND
END CATCH
END
 
 
Above proc returns some output data please how to retreve to frantend using entityfreamework 

Answers (5)