-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
  • 115,751
  • 26
  • 228
  • 437
philipmrz
  • 31
  • 6

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
  • 31
  • 6