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“.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.