0

I selected a database from a combobox. And I want to connect to it so that I can create tables in it using PyQt. I think I should use the currentIndex, but I can't figure out how to do it.

I saw that there is this code for layers: layer = self.dlg.comboBox.currentData()

And this one for texts: lyr_name = my_combo.currentText()

So, I think it's going to be sqdb=self.ui.comboBox.currentIndex()

Only when I write this connection = sqlite3.connect(sqdb), an error NameError: name 'connection' is not defined shows up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.