0

I am using python 2.7 and trying to use LIKE method with sqlite3

search1 = self.lineEdit.text()
search = unicode(search1)
conn = sqlite3.connect('storage/container.db')
c = conn.cursor()
c.execute("SELECT * FROM reports WHERE LIKE('؟%',outIn)=1 OR LIKE('؟%',itemName)=1 OR LIKE('؟%',itemUser)=1", (search, search, search, ))

gives me an error :

Traceback (most recent call last):
  File "C:\python\townoftechwarehouse\reports.py", line 67, in create_report
    c.execute("SELECT * FROM reports WHERE LIKE('؟%',outIn)=1 OR LIKE('؟%',itemName)=1 OR LIKE('؟%',itemUser)=1", (search, search, search, ))
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 0, and there are 3 supplied.
[Finished in 18.2s]
Ahmed Wagdi
  • 3,913
  • 10
  • 50
  • 116

1 Answers1

0

As documented here, the correct placeholder for sqlite3 is '?', not '%s'.

bruno desthuilliers
  • 75,974
  • 6
  • 88
  • 118