-
Notifications
You must be signed in to change notification settings - Fork 0
/
Attendance_Column_Creator.py
34 lines (27 loc) · 1.48 KB
/
Attendance_Column_Creator.py
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
32
33
34
#Creating Columns For Attendance
import mysql.connector
import tkinter.messagebox
def attendance_column(course_name,attendance_date):
database=mysql.connector.connect(host="localhost",user="root",passwd="Password@123",database="Attendance_Management_System")
mycursor=database.cursor()
try:
mycursor.execute(f"ALTER TABLE {course_name} ADD COLUMN ({attendance_date+'_Lec1'} VARCHAR(10) DEFAULT '' NOT NULL)")
lecture_count = attendance_date+'_Lec1'
except:
try:
mycursor.execute(f"ALTER TABLE {course_name} ADD COLUMN ({attendance_date+'_Lec2'} VARCHAR(10) DEFAULT '' NOT NULL)")
lecture_count = attendance_date+'_Lec2'
except:
try:
mycursor.execute(f"ALTER TABLE {course_name} ADD COLUMN ({attendance_date+'_Lec3'} VARCHAR(10) DEFAULT '' NOT NULL)")
lecture_count = attendance_date+'_Lec3'
except:
try:
mycursor.execute(f"ALTER TABLE {course_name} ADD COLUMN ({attendance_date+'_Lec4'} VARCHAR(10) DEFAULT '' NOT NULL)")
lecture_count = attendance_date+'_Lec4'
except:
tkinter.messagebox.askquestion('MISSION : TERMINATE All STUDENTS','Do you want to continue with your mission?')
return lecture_count
#course_name=input("Enter Course Name: ")
#attendance_date=input("Enter Date for Attendance: ")
#attendance_column('hu100','19_12_2019')