SubSonic SQL CE 错误
我有一个旧的 C# 项目,当前在 SQL CE 数据库上运行。我昨天决定使用 SubSonic 为我生成 DAL,因为我在其他项目(带有标准 MS SQL 数据库后端)中大量使用了 SubSonic,并且我喜欢它的易用性。
一切看起来都很好,我可以创建和删除记录,但是一旦我使用 Save() 方法更新记录,就会抛出错误:
示例:
Person person = new Person();
person.Name = "Robert";
person.Save(); // Works fine, record is saved
person.Name = "Robert - Updated";
person.Save(); // Fails with error below
“解析查询时出错。[ 令牌行号 = 1,令牌行偏移量= 61,令牌错误 = SELECT ]”
当我通过创建新查询并将 QueryType 设置为 Update 来更新记录时,它似乎也按预期工作。
有什么想法吗?
谢谢
I have an old c# project which currently runs on a SQL CE database. I decided yesterday that I would like to use SubSonic to generate a DAL for me as I have used SubSonic a lot in my other projects (with a standard MS SQL database backend) and I love it's ease of use.
Everything seems fine, I can create and delete records but as soon as I update a record using the Save() method an error it thrown:
Example:
Person person = new Person();
person.Name = "Robert";
person.Save(); // Works fine, record is saved
person.Name = "Robert - Updated";
person.Save(); // Fails with error below
"There was an error parsing the query. [ Token line number = 1, Token line offset = 61, Token in error = SELECT ]"
When I update a record by creating a new Query and setting the QueryType to Update, it also seems to be working as expected.
Any ideas?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试获取生成的 SQL 以查看执行的内容。
我的猜测是 SubSonic 使用
[
和]
转义列名或表名,这对于成熟的 SQL Server 来说很好,但它的 CE 对应项不支持这一点。Try to get hold of the generated SQL to see what gets executed.
My guess is that SubSonic escapes column or table names with
[
and]
, which is fine for a full-blown SQL Server, but its CE counterpart does not support that.我的猜测是 Subsonic 正在尝试在单个命令中执行多个 SQL 语句 - SQL Compact 不支持此操作
My guess is that Subsonic is trying to execute several SQL statments in a single command - this is not supported by SQL Compact