I am trying to execute stored procedure from bcontext.Database.SqlQuery using EF5.
It is throwing an error must declare the scalar variable \'@custid\'
<
Try
var results = _MiscContext.Database.SqlQuery<int>(
"exec sp_GetStaff {0}",
customerNumber).ToList();
Since you're using named parameters, you have to specify the matching name for the parameter you're passing.
var results = _MiscContext.Database.SqlQuery<int>(
"exec sp_GetStaff @custid",
new SqlParameter("custid", customerNumber)).ToList<int>();