-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconnect.py
More file actions
31 lines (26 loc) · 1.14 KB
/
connect.py
File metadata and controls
31 lines (26 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import sqlite3
class myconnect:
def __init__(self):
#4
self.conn=sqlite3.connect("emp.db")
#5
try:
self.conn.execute('''create table if not exists emp (name text,email text,emp_type char,mobile text,experience integer,salary integer)''')
except:
pass
def savetodb(self,ename,eemail,emob,etype,eexp,esalary):
#6
self.conn.execute("insert into emp values (?,?,?,?,?,?)",(ename,eemail,etype,emob,eexp,esalary))
self.conn.commit()
print("Record Added Successfully")
def display(self):
#7
email=input("enter the email : ")
data=self.conn.execute("select * from emp where email=:eml",{"eml":email})
for row in data:
print("Name:",row[0])
print("Email:",row[1])
print("Emp_Type:",row[2])
print("Mobile no:",row[3])
print("Experience:",row[4])
print("Salary:",row[5])