SubSonic SQL CE 错误

发布于 2024-08-19 07:33:21 字数 535 浏览 3 评论 0原文

我有一个旧的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

别想她 2024-08-26 07:33:21

尝试获取生成的 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.

温柔戏命师 2024-08-26 07:33:21

我的猜测是 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文