Alex Guerin
Alex Guerin

Reputation: 2386

Web Developer/WebMatrix: SQL CE database table error when editing

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

Upvotes: 0

Views: 199

Answers (1)

Justin Beckwith
Justin Beckwith

Reputation: 7866

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!

Upvotes: 1

Related Questions