Delete Student
1. delete_from_database()
function
delete_from_database()
function1.1 Description:
This function deletes a student's file from the database directory. It constructs two file paths based on the student's last name and first name, and attempts to remove the corresponding files. If the deletion fails for both file paths, the function returns false
; otherwise, it returns true
.
1.2 Syntax:
Short Form:
Full Form:
1.3 Parameters:
1.5 Return Value:
The function returns true
if the deletion is successful, and false
otherwise.
1.6 Usage:
This function is used to remove a student's file from the database directory when deleting their information from the database.
2. deleteStudent()
function:
deleteStudent()
function:2.1 Description:
This function allows the user to delete a student's information from the database. It prompts the user for the student's first name and last name, confirms the deletion action, and calls the delete_from_database()
function to delete the student's file.
2.2 Syntax:
Short Form:
Full Form:
2.3 Function Tasks:
Prompt the user to enter the student's first name and last name.
Display a warning message to inform the user about the deletion action.
Wait for any key input to confirm or press 'Q' to abort the deletion.
If the user aborts, return from the function.
Call the
delete_from_database()
function with the provided first name and last name.Display a success message if the deletion is successful.
Display an error message if the deletion fails or the student cannot be found.
Refresh the screen.
Please note that the explanations in the Return Value section of delete_from_database()
and the Function Tasks section of deleteStudent()
are placeholders and should be replaced with the actual information about the return value and function tasks, respectively.
Last updated