What causes “Incorrect syntax near ” in EF Code First and SQL 2005?

后端 未结 2 521
醉梦人生
醉梦人生 2021-02-15 10:24

The examples for System.Data.Entity.Database.SqlQuery method I\'ve found appear to work well with SQL 2008 R2 but do not appear to work with SQL 2005.

This call will wor

2条回答
  •  时光说笑
    2021-02-15 11:13

    You only need EXEC if there are any statements before "GetDataFromMySp" in the batch. A stored procedure name by itself should be OK.

    I'd run SQL Profiler to see what is being actually being sent by EF.

    Things like "prepared statements" issue extra commands as part of the batch in addition to your command text.

    See this: http://social.msdn.microsoft.com/Forums/eu/adonetefx/thread/bae30a3d-7a66-4aff-af99-6426cf0483b5

提交回复
热议问题