What am I doing wrong here?
...
using (var ctx = ObjectContextManager<MyDataContext>.GetManager("MyDataContext"))
{
var idsToUpdate = "2,3";
var parameters = new[]
{
new SqlParameter("DesiredEndDate", SqlDbType.DateTime).Value = newUpperLimit,
new SqlParameter("TasksToUpdate", SqlDbType.NVarChar).Value = idsToUpdate
};
ctx.ObjectContext.ExecuteStoreCommand("UPDATE dbo.Tasks SET DesiredEndDate = @DesiredEndDate WHERE Id IN (SELECT Id FROM dbo.fn_Split(@TasksToUpdate, N','))", parameters);
ctx.ObjectContext.SaveChanges();
}
...
I get the error
Must declare the scalar variable "@DesiredEndDate".
Must declare the scalar variable "@TasksToUpdate".
But I cannot see what is wrong with my code :/