I want to execute a stored procedure
CREATE PROCEDURE [dbo].[sp_Insert_Donor_Details]
@Name nvarchar(50),
@Address nvarchar(MAX),
@Phone nchar(10),
@Pin nchar(10),
@Email nvarchar(50),
@DOB nvarchar(9),
@Ann nvarchar(9),
@DeathAnn nvarchar(9),
@Family bit
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO tbl_Donor_Details (Name, [Address], Phone, EmailID, Pincode, DOB, Anniversary, DeathAnniversary, HasFamily)
VALUES (@Name, @Address, @Phone, @Email, @Pin, @DOB, @Ann, @DeathAnn, @Family)
SELECT SCOPE_IDENTITY() AS DonorID
END
GO
Here I want to get the DonorID in my code. My c# code to call the stored procedure is:
if (txtName_1.Text != "" || txtName_2.Text != "" || txtName_3.Text != "" || txtName_4.Text != "")
family = true;
var result = GDB.sp_Insert_Donor_Details(txtName.Text, txtAddress.Text, txtPhone.Text,
txtEmail.Text, txtPin.Text, txtDOB.Text, txtAnniversary.Text, txtDeathAnniversary.Text,
family).ToList();
Please help me out how can I get result as DonorID (scope identity from the database). Currently I am getting System.Decimal as the value of result.