Feb-17-2019, 07:37 PM
Okay, so the uid is a list of numbers, right? In which case we need to make them a string and check it against the db, so to adjust the above code:
for e.g. uid = [150,110,1,164]
uid_str = ','.join([str(i) for i in uid])
then we create the sql for the query:
sql_str = "SELECT * FROM anställda WHERE ID = ?"
and the data for the query is now the uid_str we created from the list of numbers (i.e. "150,110,1,64"
so we use that as the data and pass it to the execute function:
conn.execute(sql_str, uid_str)
for e.g. uid = [150,110,1,164]
uid_str = ','.join([str(i) for i in uid])
then we create the sql for the query:
sql_str = "SELECT * FROM anställda WHERE ID = ?"
and the data for the query is now the uid_str we created from the list of numbers (i.e. "150,110,1,64"
so we use that as the data and pass it to the execute function:
conn.execute(sql_str, uid_str)