1
我使用sqlite3的Python模块和次下面的代码返回错误sqlite的InterfaceError:错误绑定参数0 - 可能是不支持的类型
InterfaceError: Error binding parameter 0 - probably unsupported type
注意我已经尝试与正常(非Unicode)的字符串,其结果是相同
# get database cursor
cur = dbConnection.cursor()
# create table for prices
cur.execute("""
create table if not exists
prices(time text,
mid integer,
exid text,
selid integer,
priceone real,
sometext text,
price2 real,
primary key (time, mid, exid, selid, priceone)
foreign key (time, mid, exid, selid) references selection(time, mid, exid,selid))""")
#insert price
tuple = (u'20120228153239788135', 104982590, 1, 4764315, 1.99, u'B', 0.07)
cur.execute("insert into prices values (?,?,?,?,?,?,?)", tuple)
您发布的代码适合我。附注:尽量避免使用内置名称作为变量名称。 – bernie 2012-02-28 21:50:16