Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在更新数据时遇到问题。我使用preparedstatement将值传递给它:
"UPDATE Employee SET " + name + " = ? WHERE Employee_ID = ?"
这是一个例外,“ you have an error in your sql syntax”。
you have an error in your sql syntax
在您给定的查询中, + name + 似乎只是变量,然后它必须与基础表中的列名匹配,因为我已经采用了Employee。如果该列不存在,那么它将引发异常。
"UPDATE Employee SET col_name(table column name) = ? Where Employee_Id = ?"