Python PDBC with OOPs Part – 3
Program 1 # PDBC with OOPS import MySQLdb class EmployeeDatabase: # Connection def __init__(self): self.con=MySQLdb.connect(host=’localhost’,user=’root’,password=’root’,database=’college’) #print(“Connection success”) # Insert record def insertdata(self,name,dept,salary,gender,city): try: sql=”insert into employee values(%d, ‘%s’,’%s’,%d,’%s’,’%s’)” self.cur=self.con.cursor() value=(self.maxid,name,dept,salary,gender,city) n=self.cur.execute(sql %value) self.con.commit() print(“Record...