Home > Enterprise >  discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: OperationalEr
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: OperationalEr

Time:11-02

when I'm trying to remove specific things from my Database (sqlite3) it's giving me error: discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: OperationalError: near ",": syntax error for some reasons, here's the needed code:

c.execute("DELETE FROM accounts WHERE email=?, password=?", (newresults[0], newresults[1]))

By the way, the values newresults[0] and newresults[1] are defined in the main code.

and heres the full traceback:

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

CodePudding user response:

You need to use AND:

"DELETE FROM accounts WHERE email=? AND password=?"
  • Related