Back Student Management System with MySQL using Python | Final Part

60-90
Created By: Coding Lifestyle 4u
Published At: 2022-08-16
Search Query: Python MySQL Get Started,Python MySQL Order By,Python MySQL Where
Tags: student management system in python student management system student management system using tkinter student database management system in python employee management system in python student management system using python for beginners python gui project python tkinter project python mysql project
Student Management System with MySQL using Python Final Part

This project contains basic functions which include adding students, updating students, viewing students, searching students, removing the student, and exporting data of students in an excel file. It uses mysql database to store the data.

This is a step-by-step tutorial for beginners. Feel free to ask your doubts in the comments section.

Get the source code and images:
https://faizan-er.myinstamojo.com/product/53265/student-management-system-with-mysql-ca1a8/

Get the images:
https://drive.google.com/drive/folders/1ox0wcIywZmJic7sqmkxa6gXjq4vsJ_0K?usp=sharing

Time Stamp:
(00:00:00) Intro
(00:00:21) Styling Treeview
(00:10:08) Update Student Functionality
(00:33:52) Code Formatting
(00:58:10) Export Data Functionality
(01:14:50) Exit Functionality
(01:17:08) Ending

Terms related to this video:
student management system in python
student management system
student management system using tkinter
student database management system in python
employee management system in python
student management system using python for beginners
python gui project
python tkinter project
python mysql project

Tags:
#codinglifestyle4u #studentmanagementsystemusingpython
#pythonguiproject #tkinterproject

★★★ Subscribe ★★★
https://www.youtube.com/channel/UCG6ztZE3zK2aZeJZKnvohkg

★★★ Follow ★★★
https://www.instagram.com/coding_lifestyle_4u/

For Business Contact: codinglyfstyle@gmail.com

Stay tuned for upcoming projects 🙂
logo Ask VidTutorAssistant
Comment
or
Question
Your name
Comments with generated responses
@Drama_World1994
2023-09-01

what is database username and password hostname ?

@codinglifestyle4u

hostname='localhost' , username and password will be the same which u have set while installing mysql

VidTutorAssistant (GPT-4)

Hi @Drama_World1994, in regards to your question about the database username, password, and hostname, these pieces of information depend on your specific database setup. Normally, when you install a database system like MySQL, Postgres, or SQLite, you are prompted to create a username and password. This is the information you would use when connecting to your database in your script. The hostname is typically 'localhost' when you're working on a local machine. However, if you are using a remote database, you'd replace 'localhost' with the IP address or URL of your remote server. I hope this leads you in the right direction. Do let me know if you need more clarity. Happy coding!


@henryfox2001
2023-03-17

Hello Faizan, Thank you for your amazing help.
I have a question. How can I prevent this to happens?

Exception in Tkinter callback

Traceback (most recent call last):

File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64_qbz5n2kfra8p0\lib\tkinter\__init__.py", line 1921, in __call_

return self.func(*args)

File "d:\Documents\byu-idaho\2_semester\cse111\w11\student_management_system\sms.py", line 113, in delete_student

content_id=content['values'][0]

IndexError: string index out of range

This happened after connecting to the database and click directly on the Delete Student button, instead of clicking on the Show Student button and then clicking on the Delete Student button.

Again, thank you for your help.

@codinglifestyle4u

You can apply a condition that if there is nothing on treeview then simply pass otherwise delete the record

VidTutorAssistant (GPT-4)

Hello @henryfox2001, I'm glad you're finding the videos helpful and thank you for bringing this error to my attention.

The error you're encountering is due to an IndexError. It appears this issue arises because you're trying to delete a student from your database before displaying or selecting it (keying in on the 'Show Student' button then 'Delete Student' sequence). Therefore, content['values'][0] is not able to receive any data, which results in an "IndexError: string index out of range" error.

To prevent this from occurring, you need to add a condition to your "delete_student" method to check whether a student data is selected before attempting to delete. Additionally, wrap your delete operation in a try-except block to catch IndexError as follows:

```python
def delete_student():
try:
content = student_table.item(student_table.focus())
content_id = content['values'][0]
# Continue with deletion logic...
except IndexError:
print("No student selected. Please select a student before attempting to delete.")
```

This way, it will provide a message to the user instead of raising an exception when no row is selected before clicking the 'Delete Student' button. Always be sure to select or display student data first to avoid this issue in the future.

I hope this helps! Feel free to ask any more questions you might have. Keep coding and learning!