python - Why does Sqlite tell me no such column exists when I plainly created it? -


in python 2.6.5 sqlite3.version 2.4.1, use following code:

c = conn.cursor()  # create table c.execute('''create table stocks (date text, trans text, symbol text,  qty real, price real)''')  # insert row of data c.execute("""insert stocks           values ('2006-01-05','buy','rhat',100,35.14)""")  # save (commit) changes conn.commit()  c.execute('''insert stocks values(date=?, trans=?, symbol=?, qty=?, price=? )''', ('08-26-1984', 'sell', 'gogl', 3, 400.00))  # can close cursor   if done c.close() 

and throws error:

traceback (most recent call last):   file "dbtest.py", line 18, in <module>     c.execute('''insert stocks values(date=?, trans=?, symbol=?, qty=?, price=?)''', ('08-26-1984', 'sell', 'gogl', 3, 400.00)) sqlite3.operationalerror: no such column: date 

my question - heck??? created column name "date"! i've spend last 2 hours trying figure out in world wrong , i'm getting frustrated. also, when try open command line, i'm told:

unable open database "orders": file encrypted or not database

any appreciated i'm put computer through wall.

thanks!

incorrect syntax insert statement. work:

>>> c.execute('''insert stocks                   (date, trans, symbol, qty, price)values(?,?,?,?,?)''',                   ('08-26-1984', 'sell', 'gogl', 3, 400.00)) 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -