我的查询是:
UPDATE Residents
SET roomStage = '1', SET roomNumber = '3', SET roomID = '26'
WHERE Id = '35'
每个列名都很好,但我收到错误:
System.Data.SqlClient.SqlException: „Incorrect syntax near the keyword 'SET'.”
我无法看到问题......但我很累,所以也许我会错过一些东西......?
答案 0 :(得分:4)
你的套装只需要在那里一次。
UPDATE Residents
SET roomStage = '1', roomNumber = '3', roomID = '26'
WHERE Id = '35'
答案 1 :(得分:2)
您没有指定sql
引擎,但是,您的查询有多个SET
运算符:
UPDATE Residents
SET roomStage = '1', SET(here) roomNumber = '3', SET(here) roomID = '26'
WHERE Id = '35'
所以你的查询应该就像:
UPDATE Residents
SET roomStage = '1', roomNumber = '3', roomID = '26'
WHERE Id = '35'
如果您使用的是市场中的
SQL Server
或任何引擎,则应始终首先查看文档,例如: https://docs.microsoft.com/en-us/sql/t-sql/queries/update-transact-sql