Prasad Bhagat

Prasad Bhagat

  • NA
  • 516
  • 234.4k

retun the db value after proc execute in json?

Aug 26 2015 10:18 AM
ALTER PROCEDURE [dbo].[abc]
@FriendNumber VARCHAR(20),
@CountryCode VARCHAR(10),
@OS VARCHAR(20),
@Token VARCHAR(200)
AS
BEGIN
BEGIN TRY
IF (SELECT COUNT(*) FROM dbo.DeviceMaster
WHERE Number = @FriendNumber AND CountryCode = @CountryCode) = 0
BEGIN
--ASK FRIEND TO DOWNLOAD THE APP
SELECT 'Send App. download link to Friend' AS STATUSMSG, -2 AS STATUSIND
END
ELSE
BEGIN
DECLARE @DeviceId BIGINT
DECLARE @FriendDeviceId BIGINT
SELECT @DeviceId = Id
FROM dbo.DeviceMaster
WHERE Token = @Token AND OS = @OS
SELECT @FriendDeviceId = Id
FROM dbo.DeviceMaster
WHERE Number = @FriendNumber AND CountryCode = @CountryCode
INSERT INTO dbo.Friends
(DeviceId,
FriendDeviceId,
FriendNumber,
AddedDate)
VALUES
(@DeviceId,
@FriendDeviceId,
@FriendNumber,
GETDATE())
SELECT 'Friend addedd successfully.' AS STATUSMSG, 1 AS STATUSIND
END
END TRY
BEGIN CATCH
SELECT ERROR_MESSAGE() AS STATUSMSG, -1 AS STATUSIND
END CATCH
END
how to retun this value in my asp.net application in json

Answers (2)