QComboBox.curfrentText()不工作-我总是得到TypeError: execute()参数1必须是s



我的sqlstr怎么了

def clicker(self):
cursor = self.conn.cursor()
sqlstr = ('''
SELECT t1.column3, t2.column2, t2.column3, t2.column4
FROM t1
INNER JOIN t2 ON t1.id_number = t2.id_number
WHERE t1.column3 = ? AND t2.column2 = ?''',
(self.qcombobox1.currentText()), (self.qcombobox2.currentText()))

我得到TypeError: execute()参数1必须是str,而不是元组

Thanks in advance…

您将execute()sqlstr作为参数,尝试将execute(*sqlstr)作为不同的参数解压缩元组

最新更新