Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def remove_students():
- with sqlite3.connect("BehaviourManagement.db") as db:
- cursor = db.cursor()
- flag1 = True
- while flag1 == True:
- print("information of student you wish to remove")
- first_name = input("Enter first name: ")
- surname = input("Enter surname: ")
- year_group = int(input("Enter year group: "))
- cursor.execute('SELECT first_name, surname, year_group From students WHERE first_name="%s" AND surname="%s" AND year_group="%s"' % (first_name, surname, year_group))
- if cursor.fetchone() is not None:
- student_info = ((first_name,), (surname,), (year_group,))
- cursor.execute(remove_student, student_info)
- db.commit()
- if cursor.fetchone() is None:
- print("student has been removed")
- flag1 = False
- db.commit()
- else:
- ("error has occured... student has'nt been removed")
- flag1 = False
- else:
- print("there is no such student in the database... try again")
- Traceback (most recent call last):
- File "C:Python33libtkinter__init__.py", line 1475, in __call__
- return self.func(*args)
- File "M:computer science a2comp 3login.py", line 186, in remove_students
- cursor.execute(remove_student, student_info)
- sqlite3.OperationalError: near "(": syntax error
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement