Home > Enterprise >  QComboBox.curfrentText() not working - i always get TypeError: execute() argument 1 must be str, not
QComboBox.curfrentText() not working - i always get TypeError: execute() argument 1 must be str, not

Time:05-18

What's wrong with my 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()))

I am getting TypeError: execute() argument 1 must be str, not tuple

Thanks in advance...

CodePudding user response:

You give execute() sqlstr as an argument, try execute(*sqlstr) instead to unpack the tuple as different arguments.

  • Related