在UPDATE语句中继续获取语法错误

时间:2017-03-20 22:28:48

标签: sql sql-server vb.net

由于某种原因,我一直收到语法错误。代码对我来说很好..我做错了吗?

 query = "UPDATE misperDB SET name=?, surname=?, DOB=?, " &
    "[NHS No]=?, [Hosp No]=?, [Info Source]=?, [Missing From]=?, [Reporter Name]=?, [Reporter Contact]=?, Ethnicity=?, [Hair Colour=?], [Eye Colour=?], [Top Clothing=?], [Bottom Clothing=?], Cannula=?, [OBS Time=?], [OBS Date=?], [High Risk=?], Notes=?" &
    " WHERE id=?"

1 个答案:

答案 0 :(得分:0)

正如史蒂夫评论的那样,对于某些变量,括号的使用不正确:

 query = "UPDATE misperDB SET name=?, surname=?, DOB=?, " &
    "[NHS No]=?, [Hosp No]=?, [Info Source]=?, [Missing From]=?, [Reporter Name]=?, [Reporter Contact]=?, Ethnicity=?, 
--[Hair Colour=?], 
[Hair Colour]=?, [Eye Colour]=?, [Top Clothing]=?, [Bottom Clothing]=?, Cannula=?, [OBS Time]=?, [OBS Date]=?, [High Risk]=?, Notes=?" &
    " WHERE id=?"