I am trying to update values in my sqlite database using the below function
def updateNameById(self, id, val):
c.execute("UPDATE {0} SET name = {1} WHERE rowid = {2}".format(table,val,id))
I also tried to write this function in different variations like
c.execute("UPDATE "+table+" SET name = "+val+" WHERE rowid = "+id)
#same error
I also tried
c.execute("UPDATE ? table SET name = ? WHERE rowid = ?,(table,val,id))
#this one gives syntax error near ?
when called from with code
print(obj.updateNameById(1,'Aquib'))
It gives sqlite3.OperationalError: no such column: Aquib
I also tried to put the id parameter as string and double single quotation stuff but all result in the same error after trying many combinations and looking up answers all over I finally posted this question