Waheed Mohammad Waheed Mohammad - 29 days ago 7
JSON Question

Why Json not accepting 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 its in Mvc Json format its through 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)
Comments