Kevin777
Kevin777

Reputation: 45

Unable to update Multiple cloums in a sql database table using pyodbc

I'm currently working on a school project. I need to update GPS coordinates in table. I'm using Raspberry pi board, pyodbc, freeTds and sql database. I cant update multiple items in a row..

cursor.execute("update Gps_table set longitude=(?) latitude=(?) where gps_id=1", s1, s2)

This above code doesn't work.. but i had figure it out, when i pass only one variable at a time it works. Which means those below codes are working..

cursor.execute("update Gps_table set longitude=(?) where gps_id=1", s1)
cursor.execute("update Gps_table set latitude=(?) where gps_id=1", s2)

But i need to update those two parameters at once. Can any one help me out Please. Thanks for reading this..

Upvotes: 2

Views: 852

Answers (1)

tuomur
tuomur

Reputation: 7098

See the SQL UPDATE syntax:

cursor.execute("update Gps_table set longitude=?,latitude=? where gps_id=1", s1, s2)

Upvotes: 3

Related Questions