Insert String in Python SQLite Statement -


I am trying to insert a string into a SQLite selection statement in Python. When I try this code:

  cur.execute ("SELECT * FROM DB where employee name = '?'", (EmpNum,))   

I get this error:

  sqlite3. Programming Error: Supply of wrong number of binary. Current statement uses 0, and 1 is supplied there.   

When I try this code:

  cur.execute ("SELECT * FROM DB where employee Num = '", I get this error:  
  Type error: the function takes up to 2 arguments (3 given)      

Code>

How do I ask this string? Sorry I'm new to Python Any help would be appreciated! "post-text" itemprop = "text">

The string with commas only works with print <> . Instead try this:

  cur.execute ("select * FROM DB where employee name = '" + empNum + "'")    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -