Web Developer/WebMatrix:编辑时 SQL CE 数据库表错误

发布于 2024-12-20 14:29:48 字数 265 浏览 4 评论 0原文

我有一个刚刚创建的 SQL CE 数据库。里面有3张桌子。尝试在 Web Developer 中编辑数据时,一个表会出错,但其他两个表工作正常。我不知道出了什么问题。

在 WebMatrix 内编辑时一切正常。

错误: 在此处输入图像描述

表架构: 在此处输入图像描述

I have a SQL CE database that has just been created. It has 3 tables in it. One table gets an error when trying to edit data inside Web Developer, but the other two work fine. I have no idea what is wrong.

All works when edited inside WebMatrix.

Error:
enter image description here

Table schema:
enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

滴情不沾 2024-12-27 14:29:48

我有点不敢相信这一点,但这看起来像是 Visual Studio 中的一个错误。您在字符 103 处收到错误,因为这是将“Cast”列添加到 SQL 语句的位置 - “Cast”是 SQL 语法中的保留关键字。

一般来说,为了解决这个问题,您可以使用括号语法来阐明您的意图:

SELECT SKU, Title, Description, OFLC, Collection, Price, Distributor, Format, RunningTime, Discs, [Cast], ImageSmall, ImageMedium, ImageLarge From Titles

但由于某种原因,VS 去掉了括号!我将继续寻找错误的答案(有趣的问题),但一般来说,您希望避免命名列保留关键字:-)

http://msdn.microsoft.com/en-us/library/aa226054(v=SQL.80).aspx

祝您编码愉快!

I kind of can't believe this, but it looks like a bug in Visual Studio. You're getting the error at character 103 because that's where the 'Cast' column is added to the SQL statement - 'Cast' is a reserved keyword in SQL syntax.

Generally to get around that, you would use the bracket syntax to clarify your intent:

SELECT SKU, Title, Description, OFLC, Collection, Price, Distributor, Format, RunningTime, Discs, [Cast], ImageSmall, ImageMedium, ImageLarge From Titles

But for some reason, VS strips out the brackets! I'll keep looking for an answer to the bug (interesting problem), but in general you want to avoid naming columns reserved keywords :-)

http://msdn.microsoft.com/en-us/library/aa226054(v=SQL.80).aspx

Happy Coding!

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