for _item in file_list:
for col in cursor.execute("select column1,column2 from tbl"):
if _item[0]==col.column1:
#I also tried using a different cursor, still doesn't work
var1 = cursor.execute("select column2 from tbl where column1=?", _item[0])
for i in var1: var2 = i[0]
try:
cursor3.execute("insert into tbl(column2,column1,column3,column4) values (?,?,?,?)", (var1, _item[0],_item[1],_item[2]))
cursor3.commit()
except IOError as error:
print error
我要做的是比较列表中的值和column1中的值,如果它们匹配,则从column2中获取同一行的值,然后使用column2中的值添加一个新行,但其余的值不同.
但不幸的是,它并没有像我那样工作,当运行 python 上面的代码时会抛出错误:
Error: ('HY010', '[HY010] [Microsoft][ODBC Driver Manager] Function sequence error (0) (SQLFetch)')
排队:
for columnrow in cursor.execute("select column1,column2 from tbl")