SubSonic Bug with TOP keyword?

断了今生、忘了曾经 提交于 2019-12-12 02:22:49

问题


The TOP keyword in the generated SQL wraps the number in brackets (I persume for SQL compact support), however this errors on my SQL 2000 server as it doesn't expect the brackets.

Example C# Code:

var doc = Logic.Document.All().FirstOrDefault(d=> d.Guid == Request.QueryString["guid"]);

Produces the following SQL error:

Line 1: Incorrect syntax near '('.

as it generates the following SQL:

 exec sp_executesql N'SELECT TOP (1) .....'

If I execute the same SQL manually without the brackets the SQL executes just fine. Is this a bug?


回答1:


After futher digging around the SubSonic SourceCode I answered a resolution here:

SubSonic3: Method "FirstOrDefault" throws exception with SQL Server 2000



来源:https://stackoverflow.com/questions/3447372/subsonic-bug-with-top-keyword

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!