Reputation: 146
I'm having problem to update data. I used preparedstatement to pass values to this:
"UPDATE Employee SET " + name + " = ? WHERE Employee_ID = ?"
This is the exception, "you have an error in your sql syntax
".
Upvotes: 0
Views: 85
Reputation: 84
In your given query the +name+ seems to be variable only then it must matches the column name in the underlying table as i have taken Employee. If the column does not exists then it'll throw an exception.
"UPDATE Employee SET col_name(table column name) = ? Where Employee_Id = ?"
Upvotes: 1