Web Developer/WebMatrix:编辑时 SQL CE 数据库表错误
我有一个刚刚创建的 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:
Table schema:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我有点不敢相信这一点,但这看起来像是 Visual Studio 中的一个错误。您在字符 103 处收到错误,因为这是将“Cast”列添加到 SQL 语句的位置 - “Cast”是 SQL 语法中的保留关键字。
一般来说,为了解决这个问题,您可以使用括号语法来阐明您的意图:
但由于某种原因,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:
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!