當我試圖從我的資料庫(sqlite3)中洗掉特定的東西時,它給了我錯誤:discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: OperationalError: near ",": syntax error由于某些原因,這是所需的代碼:
c.execute("DELETE FROM accounts WHERE email=?, password=?", (newresults[0], newresults[1]))
順便說一下,值 newresults[0] 和 newresults[1] 是在主代碼中定義的。
這是完整的追溯:
Ignoring exception in command buy:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 127, in wrapped
ret = await coro(arg)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 911, in _invoke
await self.callback(ctx, **kwargs)
File "C:\Users\user\Desktop\Sidtho\main.py", line 62, in buy
c.execute("DELETE FROM accounts WHERE email=?, password=?", (newresults[0], newresults[1]))
sqlite3.OperationalError: near ",": syntax error
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 1008, in invoke_application_command
await ctx.command.invoke(ctx)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 359, in invoke
await injected(ctx)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 135, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: OperationalError: near ",": syntax error
uj5u.com熱心網友回復:
您需要使用 AND:
"DELETE FROM accounts WHERE email=? AND password=?"
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/525566.html
