Doubt in line commands with sql


Good, I am trying to modify the history box with what I entered, but for that it must coincide with the cc and date, I have a command line in sql but it is not saving me in the database

sql="UPDATE Cita set Historias='"+str(AGGH.get())+"' WHERE cc="+str(AGG2.get())+" and fecha="+str(AGG4.get())

I add that I am handling python and str (AGG2.get ()) are the data entered. Thank you very much for your collaboration

asked by JPSuarezQ 10.07.2017 в 23:44

1 answer


assuming that the values are varchar in the database you missed the quotes:

sql="UPDATE Cita set
         Historias = '"+str(AGGH.get())+"'
         WHERE cc  = '"+str(AGG2.get())+"' 
         and fecha = '"+str(AGG4.get())+"';"
answered by 10.07.2017 / 23:59