开发者

SubSonic Bug with TOP keyword?

开发者 https://www.devze.com 2023-01-10 18:21 出处:网络
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.

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# Co开发者_运维技巧de:

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?


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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号