繁体   English   中英

无法使用pyodbc更新sql数据库表中的多个Cloum

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

我目前正在做一个学校项目。 我需要更新表格中的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语法

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM