我是Python新手,我正在尝试做一件简单的事情。
我有两个字段一个标签(cod。client)需要从Mysql接收一个自动递增字段的select查询结果,另一个字段editline(name client)需要在数据库上进行插入。
但我不知道问题出在哪里,你能帮忙吗?遵循我的准则。在import MySQLdb
from PyQt5 import QtCore, QtGui, QtWidgets
conn = MySQLdb.connect(host="localhost", user="root", passwd="123456", db="test")
c = conn.cursor()
class Ui_MainWindow(object):
def select(self):
c.execute("SELECT id FROM client")
def insert(self):
c.execute('INSERT INTO client(name) values("%s")' % (self.nameClient))
conn.commit()
conn.close()
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(200, 200)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centra