2016-12-08 19 views
0

我有下面的代碼表中的更新值。當我運行代碼時,出現錯誤near "(": syntax error更新的SQLite數據庫使用變量

這是我的代碼:

cursor.execute('UPDATE playerList SET (gamesPlayed, totalPTS, totalREB, totalAST, totalSTL, totalTO, totalBLK, ftMade, ftAttempts, fgMade, fgAttempts, threeptMakes, threeptAttempts) = (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) WHERE playerCode = (?)', (newGp, newTotPts, newTotReb, newTotAst, newTotStl, newTotTo, newTotBlk, newFtMade, newFtAttempt, newFgMade, newFgAttempt, newThreePointMade, newThreePointAttempt, code)) 

我要去哪裏錯了?

+0

您可能想要堅持使用columname = value語法,因爲它可以更容易地查看您是否在某處找到了匹配的錯誤,並且可以格式化爲合理格式(如在一條巨型線中並非全部) – pvg

+0

始終顯示完整的錯誤信息(追溯)問題 – furas

+0

找到SQL教程並檢查'UPDATE'語法 - 對我來說這是不正確的。或者直接在數據庫中運行你的查詢,你應該得到更多的信息。 – furas

回答

0

行值僅在SQLite的3.15.0或更高版本的支持。如果您有較早的版本(可能使用任何當前的Python版本),則必須使用標準的SQL語法,即documented in the documentation