I have a stored procedure that has three parameters and I\'ve been trying to use the following to return the results:
context.Database.SqlQuery
return context.Database.SqlQuery("mySpName {0}, {1}, {2}",
new object[] { param1, param2, param3 });
//Or
using(var context = new MyDataContext())
{
return context.Database.SqlQuery("mySpName {0}, {1}, {2}",
new object[] { param1, param2, param3 }).ToList();
}
//Or
using(var context = new MyDataContext())
{
object[] parameters = { param1, param2, param3 };
return context.Database.SqlQuery("mySpName {0}, {1}, {2}",
parameters).ToList();
}
//Or
using(var context = new MyDataContext())
{
return context.Database.SqlQuery("mySpName {0}, {1}, {2}",
param1, param2, param3).ToList();
}