I am working with Entity Framework in C# and am having an issue which I have tracked down to the SQL statement being generated.
The stored procedure takes in a table
You will have to specify the parameter mappings in your sql string for it to work. i.e in the C# code replace
db.Database.SqlQuery("EXEC dbo.SaveResults", resultId, positiveResults)
with
db.Database.SqlQuery("EXEC dbo.SaveResults @resultId=@resultId, @positiveResults=@positiveResults", resultId, positiveResults)
It seems sp_executesql
is unable to automatically associate the passed parameters to the expected parameters when executing a stored procedure unless the mappings are manually specified in the SQL string passed