SubSonic3:方法“FirstOrDefault” SQL Server 2000 抛出异常
我将 SubSonic3 与 SQL Server 2000 一起使用。
我对方法“FirstOrDefault”有问题 - 它总是抛出异常 =“第 1 行:'('.”附近的语法不正确。”来自 SubSonic.Linq dll
编辑(从注释中添加代码) :
InventoryDAL = DAL project name (dll)
Inventort= Subsonic3 Gnerated classes
Name space WHWarehouses = gnerated object
Dim WareH = (From Wh In InventoryDAL.Inventort.WHWarehouses.All _
Where Wh.WarehouseID = 1 ).FirstOrDefault
I am using SubSonic3 with SQL Server 2000.
I have problem with the method "FirstOrDefault" - it always throws an exception = "Line 1: Incorrect syntax near '('." from the SubSonic.Linq dll
EDIT (Added code from comment):
InventoryDAL = DAL project name (dll)
Inventort= Subsonic3 Gnerated classes
Name space WHWarehouses = gnerated object
Dim WareH = (From Wh In InventoryDAL.Inventort.WHWarehouses.All _
Where Wh.WarehouseID = 1 ).FirstOrDefault
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道 SubSonic,但是 Hibernate 有不同的 SQL 方言,您可以告诉它使用,可能想看看是否有任何方法告诉它使用 SQL 2000 的方言
I don't know SubSonic, but Hibernate has different dialects of SQL you can tell it to use, might want to see if there is any way to tell it to use a dialect for SQL 2000
这也是我遇到过的问题,不幸的是,生成 TOP 的代码是在 SubSonic 依赖项中生成的,无法在 TT 模板中更改。
在 TSqlFormatter.cs 类下的 SubSonic 源代码中,有一个方法
删除
......。
db.Append 中的括号应该可以解决 SQL 的问题,但我不确定这是否会破坏其他SQL Compact Edition 等提供商?
在我阅读您的查询之前,我在这里提出了:带有 TOP 关键字的 SubSonic Bug?。
希望这有帮助。
This is a problem I've encountered too and unfortunately the code to generate the TOP is generated in the SubSonic Dependency and cannot be changed in the TT templates.
In the SubSonic source under TSqlFormatter.cs class is a method
...
....
Removing the brackets in db.Append should fix the issue for SQL but I'm not sure whether this may break other providers such as SQL Compact Edition?
I raised it here: SubSonic Bug with TOP keyword? before I read you query.
Hope this helps.