Doubt in line commands with sql

1

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())
cursor.execute(sql)

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
source

1 answer

2

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
source