I have a stored proc which takes a int as parameter. I am using entity framework code first along with MVC and I am making the call in this manner
SqlParameter sa = new SqlParameter("@userId", userId);
var query = from dashboardData in TBSCIDBContext.Database.SqlQuery<MyNomination>("sp_GetMyNominationList @userId", sa)
select dashboardData;
return query.ToList();
in profiler I get
exec sp_executesql N'sp_GetMyNominationList @userId',N'@userId int',@userId=4
This executes correctly on using sql server 2008 but now my db is changed to 2005
and the same exec statement gives me
Incorrect syntax near ‘sp_GetMyNominationList’. because I am running it in 2005.
I have to use 2005 please tell me a way to make this run in 2005 so that the parameter is taken correctly by the sql profiler
The answer to my question is
This works