在这里,我想使用entityframework使用参数调用存储过程 它得到错误:PROCEDURE ntc_sales.AgentAmounts的参数数量不正确;预期1,得0 代码
`enter code here`[HttpGet]
public virtual List<AgentAmounts> AgentAmountbyId(int id)
{
string SQLQuery = @"call AgentAmounts();";
var objectContext = ((IObjectContextAdapter)db).ObjectContext;
//List<object> listobj = new List<object>();
List<AgentAmounts> data = objectContext.ExecuteStoreQuery<AgentAmounts>(SQLQuery,
id).AsQueryable().ToList();
return data;
}
答案 0 :(得分:2)
public virtual List<AgentAmounts> AgentAmountbyId(int id)
{
string SQLQuery = @"call AgentAmounts(@vagent);";
var objectContext = ((IObjectContextAdapter)db).ObjectContext;
//List<object> listobj = new List<object>();
List<AgentAmounts> data = objectContext.ExecuteStoreQuery<AgentAmounts>(SQLQuery,new Mysqlparamter("@vagent",id).AsQueryable().ToList();
return data;
}