I'm trying to test a small piece of code I wrote to search a column of a table for a specific string. The code should search the Users column of the LoginInfo table and print out the result. I have tried two versions of this code but both get different errors.
VERSION ONE:
import sqlite3
import sys
Username = "('Hello1',)"
print(Username)
connection= sqlite3.connect("Logininfo.db")
c = connection.cursor()
c.execute('''SELECT Username FROM LoginInfo WHERE Username=Hello1''')
for row in c :
print(row)
VERSION ONE ERROR:
c.execute('''SELECT Username FROM LoginInfo WHERE Username=Hello1''') sqlite3.OperationalError: no such column: Hello1
VERSION TWO:
import sqlite3
import sys
Username = "('Hello1',)"
print(Username)
connection= sqlite3.connect("Logininfo.db")
c = connection.cursor()
c.execute("SELECT Username FROM LoginInfo WHERE Username="Hello1"")
for row in c :
print(row)
VERSION TWO ERROR:
Invalid syntax error pop up highlighting Hello1
Any help would be appreciated as I'm really new at this.