This is my stored procedure:
BEGIN
SET NOCOUNT ON;
INSERT INTO [dbo].[KYS_CustomerComplaints] (
CustomerId
,UserId
,STATE
,Address
,PhoneNumber
,Email
,StorageCondition
,OtherConditions
,ProductId
,ProductAmount
,LOTNo
,HandBill
,CallingBill
,ProductionDate
,ExpirationDate
,CreatedDate
,LastEditionDate
,LastEdited_UserId
,Code
)
VALUES (
@CustomerId
,@UserId
,@State
,@Address
,@PhoneNumber
,@Email
,@StorageCondition
,@OtherConditions
,@ProductId
,@ProductAmount
,@LOTNo
,@HandBill
,@CallingBill
,@ProductionDate
,@ExpirationDate
,@CreatedDate
,@LastEditionDate
,@LastEdited_UserId
,@Code
)
DECLARE @new_identity INT;
SELECT @new_identity = SCOPE_IDENTITY()
RETURN @new_identity;
END
How can I give Output Id?
var parameters = new[]
{
new SqlParameter("@CustomerId",customer.CustomerId ),
new SqlParameter("@UserId",customer.UserId),
new SqlParameter("@State",customer.State ),
new SqlParameter("@Address",customer.Address ),
new SqlParameter("@PhoneNumber",customer.PhoneNumber ),
new SqlParameter("@Email",customer.Email ),
new SqlParameter("@StorageCondition",customer.StorageCondition ),
new SqlParameter("@OtherConditions",customer.OtherConditions ),
new SqlParameter("@ProductId",customer.ProductId ),
new SqlParameter("@ProductAmount",customer.ProductAmount ),
new SqlParameter("@LOTNo",customer.LOTNo ),
new SqlParameter("@HandBill",customer.HandBill ),
new SqlParameter("@CallingBill",customer.CallingBill ),
new SqlParameter("@ProductionDate",customer.ProductionDate ),
new SqlParameter("@ExpirationDate",customer.ExpirationDate ),
new SqlParameter("@CreatedDate",customer.CreatedDate ),
new SqlParameter("@LastEditionDate",customer.LastEditionDate ),
new SqlParameter("@LastEdited_UserId",customer.LastEdited_UserId ),
new SqlParameter("@Code",customer.Code ),
};
var model = AdoNetHelper.ExecuteSql(ProcType.Scalar, ReturnType.DataSet, "CRM_CustomerComplaint_Add", parameters);
return "Başarıyla Eklendi";