Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
271 views
in Technique[技术] by (71.8m points)

Couldn't insert row in database from pyqt5 and mysql

The below is the python code to insert row in mysql

self.db = MySQLdb.connect(host='localhost', user='root', password='1234', db='plotproject')
self.cur = self.db.cursor()

siteno = self.lineEdit_43.text()  # providing siteno
siteaddress = self.plainTextEdit.text()  # providing siteaddress
pincode = self.lineEdit_45.text()  # providing sitepincode
area = self.lineEdit_46.text()  # providing sitearea

self.cur.execute('''
        INSERT INTO unregisteredsites(siteno,siteaddress,pinid,area) 
        VALUES (%d , %s ,%d ,%s)
        ''', (siteno, siteaddress, pincode, area))
self.db.commit()
print("done")

This code couldn't insert row in mysql below is the error it returns

Process finished with exit code -1073740791 (0xC0000409) The Database is

create table unregisteredsites(
siteno number(5),
siteaddress varchar(30),
pinid number(6),
area varchar(10),
);

What is wrong in it

question from:https://stackoverflow.com/questions/65651854/couldnt-insert-row-in-database-from-pyqt5-and-mysql

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...