-1

I want the SQL term to search for the ID that has been given by the user as input.

def autoAusgeben():

    autoID = int(input("Id des Autos eingeben: "))
    connection = sqlite3.connect("quartett.db")
    cursor = connection.cursor()

    cursor.execute("SELECT * From autos WHERE Id (?)", (autoID))
    autos = cursor.fetchall()
    print(autos)
jonrsharpe
  • 107,083
  • 22
  • 201
  • 376
philipmrz
  • 21
  • 5

2 Answers2

0

If autoID is defined earlier in code, then I believe you may be receiving some kind of "undefined function 'Id' in expression error" due to missing = sign? Does changing that line to this help?

cursor.execute("SELECT * From autos WHERE Id = (?)", (autoID))
0

After adding to missing "=" it gives the error "parameters are of unsopported type". autoID has never been used before.

EDIT: ive added a "," behind autoID in braces

Works now

Thx

philipmrz
  • 21
  • 5