2017-02-08 10 views
0

データベースに格納されている一部の製品の価格を比較しようとしていますが、比較がうまくいく間にupdateステートメントが目的のフィールドを更新していないようです。Python Sqlite3 Updateクエリが機能しない

for currentRow,newRow in zip(currentInfo,newInfo): 

    if currentRow[1]!=newRow[1]: 
     print(currentRow[0],newRow[0]) 
     print("The price of %s has changed from %s to %s" % (currentRow[0], currentRow[1], newRow[1])) 
     db.execute("update table set Prices=? where Product=?",(newRow[1],currentRow[0])) 
     conn.commit 
+2

方法 'conn.commit()私は括弧を追加するのを忘れ...本当に恥ずかしい' – lmiguelvargasf

+0

@lmiguelvargasfあるコミット。あなたの時間をありがとう – Volpym

答えて

1

あなたはちょうど()を逃したと思います。

conn.commit()

+0

ありがとう - 私も助けた。エラーメッセージを表示しないという事実は混乱しています。 – user1761806

関連する問題