Waheed Mohammad Waheed Mohammad - 1 month ago 8
JSON Question

Why is JSON not accepting a stored procedure passing variable as Id?

Here I write a stored procedure for deleting records; it's working fine in SQL. But when I try to load it in MVC JSON format it threw an error:


implementation of the query pattern for source type 'int'. 'Select' not found"


Stored procedure:

ALTER procedure [dbo].[AccessorDataDelById]
@ID int
AS
BEGIN
DELETE FROM Accessors
WHERE Id = @ID
END


JSON format:

public JsonResult GetAssdata(int iD = 0)
{
var x = (from n in db.AccessorDataDelById(iD)
select n).FirstOrDefault();

return new JsonResult { Data = x, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
}

Answer
var x=db.AccessorDataDelById(iD)