A Windows Forms-based application built using C# to manage a movie database. Users can add, edit, remove, search, display, and sort movie details. The application uses MySQL for database management and follows object-oriented programming principles.
- Allows users to insert new movie records into the database.
- Users input the movie's name, release date, genre, favorite character, and rating.
- The application will validate input, especially the rating (must be between 0 and 10).
- After entering the data, the movie is added to the database, and the list is refreshed.
- Allows users to update details of an existing movie.
- Users can change the movie's name, release date, genre, favourite character, and rating.
- The application validates the input, especially ensuring the rating is within the range.
- Once edited, the updated movie is saved back to the database.
- Allows users to remove a movie from the database.
- The user provides the movie name; if the movie is found, it is deleted from the database.
- The movie list is then refreshed to reflect the removal.
- Allows users to search for movies by name.
- The application uses a "LIKE" query to find movies that match or partially match the name entered by the user.
- If a match is found, the movie details are displayed; otherwise, a "Movie not found" message is shown.
- Displays a list of all movies in the database.
- Users can view the list sorted either by movie name or by rating.
- This feature allows for easy navigation and viewing of movie records in an ordered format.
- C# for application logic and UI (Windows Forms).
- MySQL for database management.
- Object-Oriented Programming (OOP) principles to structure the code and maintain the application.
- Install Visual Studio for building and running the C# application.
- Install MySQL for managing the database.
- Clone the repository to your local machine:
git clone https://github.com/Danial-Changez/Movie-Database.git
-
Create a MySQL database
Movie_Database
if you haven't already. -
Ensure the
movies
table is set up with the following fields:name
(TEXT)release_date
(DATE)genre
(TEXT)favorite_character
(TEXT)rating
(REAL)
Example SQL:
CREATE TABLE movies ( name TEXT(255) PRIMARY KEY, release_date TEXT, -- DATE could also be used, the result should be the same genre TEXT(100), favorite_character TEXT(100), rating REAL );
- Open the project in Visual Studio.
- Ensure your database connection string is correctly set in the
Database
class (insideconnectionString
). - Build and run the project.
- After launching the application, use the buttons to add, edit, remove, or search for movies.
- The list of movies will be displayed, and you can sort them by name or rating.
- The database will automatically be updated whenever a movie is added, edited, or removed.