[英]UPDATE statement syntax error caused by a field
I'm currently using python and pypyodbc in conjunction with Microsoft access to create and use a database, and i've stumbled across this error and i cannot figure it out 我目前正在将python和pypyodbc与Microsoft访问结合使用来创建和使用数据库,但我偶然发现了此错误,无法弄清
cursor.execute('''UPDATE user_table
SET weapon1_id = ?,
weapon2_id = ?,
aid1_id = ?,
aid2_id = ?,
armour_id = ?,
misc1_id = ?,
misc2_id = ?,
achievements = ?,
user_level = ?,
game_level = ?,
xp = ?,
money = ?
WHERE ID = ?''',
[current_user.inventory['weapons'][0].id,
current_user.inventory['weapons'][1].id,
1,1,1,1,1,
current_user.ach,
current_user.level,
current_user.game_level,
current_user.xp,
current_user.money,
user_id])
This is my UPDATE statement for my program, anytime it reaches this point in the code, it gives me this error 这是我的程序的UPDATE语句,只要到达代码中的这一点,就会出现此错误
raise ProgrammingError(state,err_text)
pypyodbc.ProgrammingError: ('42000', '[42000] [Microsoft][ODBC Microsoft
Access Driver] Syntax error in UPDATE statement.')
after messing around with it, i found out it was caused by the "current_user.money" value, so anytime i remove that value along with "money =?" 弄乱它之后,我发现它是由“ current_user.money”值引起的,因此无论何时我都将其与“ money =?”一起删除。 the code runs fine, but i don't know why this is happening, i did create the money field in my table after creating the connection string, could that be the problem? 代码运行正常,但我不知道为什么会这样,创建连接字符串后,我确实在表中创建了money字段,这可能是问题吗? the field is also a number and so is "current_user.money" so i don't think it would be a type mismatch, any help would be greatly appreciated 该字段也是一个数字,“ current_user.money”也是如此,所以我不认为这是类型不匹配的,任何帮助将不胜感激
My best guess is that money
is a reserved word. 我最好的猜测是money
是保留字。 Try using: 尝试使用:
. . .
[money] = ?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.