SQLite Forum

DELETE FROM database WHERE rowid
Login
Hello,
In adressen.py
I have:

import sqlite3

def wisadres(id):

    # Connect to database and create cursor
    conn = sqlite3.connect('adressen.db')
    c = conn.cursor()
        
    c.execute("DELETE FROM adressen WHERE rowid = (?)", id)
    
    # commit our command
    conn.commit()
    # close connection
    conn.close()

Then, in order to run it, in adressenapp.py
I have:

import adressen

adressen.wisadres('6')

When I run this, row id 6 is deleted successfully.

>>> %Run adressenapp.py

Now I like to delete e.g. row 69 with:

import adressen

adressen.wisadres('69')

Now, with this command, I become an error message:

>>> %Run adressenapp.py
Traceback (most recent call last):
  File "/home/gastonv/Programmeren/Sqlite/adressenapp.py", line 19, in <module>
    adressen.wisadres('69')
  File "/home/gastonv/Programmeren/Sqlite/adressen.py", line 100, in wisadres
    c.execute("DELETE FROM adressen WHERE rowid = (?)", id)
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 2 supplied.

Please, what can be the reason why it doesn't works?
Many thanks in advance for each answer.
Kind regards,
Gaston Verhulst.