Reputation: 63
I am trying to change a value of a whole column in MS Access database with python using pypyodbc. So far I have only found a way to create a new line but not modify the existing values.
This code is from another question I found and it works but only to create a new line (the table name is Table 1 and the column is Testie not that it really matters)
conn=pypyodbc.win_connect_mdb("C:\Users\y.johannes1\Documents\prufa.mdb")
cursor=conn.cursor()
sql= """ INSERT INTO Table1(Testie) Values(10)"""
cursor.execute(sql)
cursor.commit()
conn.close()
Any ideas?
Upvotes: 1
Views: 1957
Reputation: 63
This worked if anyone has the same problem
conn=pypyodbc.win_connect_mdb("C:\Users\y.johannes1\Documents\prufa.mdb")
cursor=conn.cursor()
sql= """ Update Table1 SET testie=7 WHERE id=1"""
cursor.execute(sql)
cursor.commit()
conn.close()
Upvotes: 4