我目前正在开展一个学校项目。我需要更新表中的 GPS 坐标。我正在使用 Raspberry pi 板、pyodbc、freeTds 和 sql 数据库。我无法连续更新多个项目..
cursor.execute("update Gps_table set longitude=(?) latitude=(?) where gps_id=1", s1, s2)
上面的代码不起作用..但我已经弄清楚了,当我一次只传递一个变量时它就起作用了。这意味着下面的代码正在工作..
cursor.execute("update Gps_table set longitude=(?) where gps_id=1", s1)
cursor.execute("update Gps_table set latitude=(?) where gps_id=1", s2)
但我需要立即更新这两个参数。任何人都可以帮帮我吗?感谢您阅读本文..
最佳答案
请参阅SQL UPDATE syntax :
cursor.execute("update Gps_table set longitude=?,latitude=? where gps_id=1", s1, s2)
关于python - 无法使用 pyodbc 更新 sql 数据库表中的多个列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25236705/