Qt:数据库插入数据

            self.database.transaction()
                query.prepare("INSERT INTO vocabulary (word) VALUES (?)")
                for word in wordList:
                    query.addBindValue(word)
                    if (not query.exec_()):
                        print("insert error:%s" % query.lastError().text())
            self.database.commit()

 

你可能感兴趣的:(Qt)