SQLite parameter substitution and quotes

前端 未结 6 1078
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-28 14:41

I have this line that works OK:

c.execute(\'select cleanseq from cleanseqs WHERE newID=\"%s\"\'%name)

But I want to use SQLite parameter su

6条回答
  •  天命终不由人
    2020-11-28 15:20

    Lose the quotes around ?

    c.execute('select cleanseq from cleanseqs WHERE newID=?',(t,))
    

    It's treating it as the string "?".

    Do you need to use double quotes around the whole expression, instead of singles?

提交回复
热议问题