2016-11-05 55 views
1

這裏我寫了一個刪除記錄的存儲過程;它在SQL中工作正常。但是,當我試圖將其加載到MVC JSON格式把它扔到了一個錯誤:爲什麼JSON不接受存儲過程作爲ID傳遞變量?

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

存儲過程:

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

JSON格式:

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 }; 
} 
+0

'DELETE'沒有按」返回一個結果集 - 因此,你不能從它「選擇」.... –

回答

1
var x=db.AccessorDataDelById(iD) 
相關問題