-4

This is my android SQL statement

I try to update the allergy table, I encounter a lot of problem

     stmt1.executeUpdate("UPDATE [dbo].[allergy] 
SET  [allergy]= "+allergyname+ ",[reaction] = "+reaction+ ",[notes] =" +notes+ " Where patientID ="+patientId);

no matter what I enter into my "allergyname"

It will say Invalid column name

what is happening?

user2399158
  • 561
  • 3
  • 10
  • 26

1 Answers1

0

Your values should be in single quotes. Try below query it will work:

stmt1.executeUpdate("UPDATE [dbo].[allergy] 
SET  [allergy]= '"+allergyname+ "',[reaction] = '"+reaction+ "',[notes] ='" +notes+ "' Where patientID ="+patientId);

Happy coding!!!!!!!!!!

Anjali
  • 1
  • 1
  • 13
  • 20