【发布时间】:2011-01-31 20:47:38
【问题描述】:
我正在测试 SubSonic,但我坚持我的第一个简单示例。我有一个新闻表,我正在尝试获取 10 个最新结果:
var newsItems = News.GetPaged("datecreated", 0, 10);
这会导致这个错误:
[MySqlException (0x80004005): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-10, 10' at line 6]
生成的 SQL:
SELECT `newsid`, `datecreated`, `headline`, `body`, `link`, `picture`, `linkinfo`, `postedby`, `comments`, `category` FROM news ORDER BY newsid DESC LIMIT -10,10
手动修复 sql 很容易,但我不知道如何让 SubSonic 自动为查询添加正确的 LIMIT。有什么指点吗?
【问题讨论】:
标签: sql mysql subsonic3 mysql-error-1064