· 9 years ago · Nov 11, 2016, 05:56 PM
1__author__ = 'snow'
2
3
4import sqlite3
5
6db_connection=sqlite3.connect("database.db")
7db_cursor=db_connection.cursor()
8
9try:
10 db_connection.execute("CREATE TABLE IF NOT EXISTS Client(ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL ,Client_name TEXT,Phone TEXT,Email TEXT )")
11 db_connection.commit()
12 print("table created")
13except sqlite3.OperationalError:
14 print(" Client table not created")
15
16try:
17 db_connection.execute("CREATE TABLE IF NOT EXISTS Orders(ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL ,Client_id INTEGER NOT NULL,Product TEXT ,Weight INTEGER,Date TEXT)")
18 db_connection.commit()
19 print("table created")
20except sqlite3.OperationalError:
21 print("order table not created")
22
23
24
25
26
27
28def Client_create():
29
30
31
32 try:
33 names=input()
34 phone=input()
35 email=input()
36 # db_connection.execute("INSERT INTO Client VALUES (?, ?, ?);",(names, phone,email))
37 db_connection.execute("INSERT INTO Client(Client_name,Phone,Email) VALUES (names,phone,email)")
38 db_connection.commit()
39 print("Client Created")
40 except sqlite3.OperationalError:
41 print("No Client Created")
42
43def Client_list():
44 print("Client list")
45
46def Order_create():
47 print("Order Created")
48
49def Order_list():
50 print("Order List")
51
52def Export():
53 print("Export")
54
55
56
57def menu():
58 print()
59 print()
60 print("-------Menu-------")
61 print("1:Client Creating")
62 print("2:Client List")
63 print("3:Order Create")
64 print("4:Order List")
65 print("5:Export Order")
66 print()
67 print("Enter the number")
68 p=int(input())
69 if p==1:
70 Client_create()
71 elif p==2:
72 Client_list()
73 elif p==3:
74 Order_create()
75 elif p==4:
76 Order_list()
77 else:
78 Export()
79
80
81menu()