Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. def remove_students():
  2. with sqlite3.connect("BehaviourManagement.db") as db:
  3. cursor = db.cursor()
  4. flag1 = True
  5. while flag1 == True:
  6. print("information of student you wish to remove")
  7. first_name = input("Enter first name: ")
  8. surname = input("Enter surname: ")
  9. year_group = int(input("Enter year group: "))
  10. 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))
  11. if cursor.fetchone() is not None:
  12. student_info = ((first_name,), (surname,), (year_group,))
  13. cursor.execute(remove_student, student_info)
  14. db.commit()
  15. if cursor.fetchone() is None:
  16. print("student has been removed")
  17. flag1 = False
  18. db.commit()
  19. else:
  20. ("error has occured... student has'nt been removed")
  21. flag1 = False
  22. else:
  23. print("there is no such student in the database... try again")
  24.  
  25. Traceback (most recent call last):
  26. File "C:Python33libtkinter__init__.py", line 1475, in __call__
  27. return self.func(*args)
  28. File "M:computer science a2comp 3login.py", line 186, in remove_students
  29. cursor.execute(remove_student, student_info)
  30. sqlite3.OperationalError: near "(": syntax error
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement