You are on page 1of 2

Visual Programming C#

BUKC
C# and Databases
Student Assignment # 2
Activity 0: Setting up the database
Create your AlbumDB database according to the following ER diagram:

Fig: The ER-Diagram of the Album database


Activity 1: Accessing a database using C#
Retrieve data from the database and display it in a windows application.
Activity 2: Searching a database from a web page
In this activity you will construct a form that accepts an album name as input, and searches the
database to determine whether or not the album is present.
Create a C# file named SearchDB with a form.
The form should contain a textbox with a label Search For Which Album? and a Submit button.
Write the C# code to access the Album database and perform an appropriate query on the database to
search for the name of the album just entered by the user.
If the album is present, display Album <albumname> is in the database. If the album is not
present, display Sorry, Album <albumname> is not in the database.
Demonstrate your modified SearchDB.
Activity 3: Populating a combo-box with data from the database
In this activity you have to create a script that queries the Album database and populates a combobox in a form with the names of the albums present in the database. When an album is selected from
the list and the Submit button pressed, the name of the band and the year the album was released
are displayed. The form also contains a Delete button that is disabled (it will be used in the next
activity).
Modify Dropdown so that when an album is selected from the drop-down list, in addition to the
band name and year of release of the Album, the song information (title and track-length) associated
with the album are also displayed.
Demonstrate your modified Dropdown
1

Visual Programming C#
BUKC
Activity 4: Adding more database functionality to forms using C#
Using Dropdown.php from Activity 3, implement the functionality associated with the Delete
button.
When the Delete button is pressed after selecting an Album from the drop-down list, delete the
selected album from the Album database.
Demonstrate your modified Dropdown by deleting the album ddd, demonstrating that it is no
longer on the list.
Activity 5: More subtle database operations using C#
When you deleted an album from the database in Activity 4, it is likely you created a referential
integrity problem because entries in the AlbumSongs table may still exist that relate songs in the
database to the deleted album.
For this activity, modify Dropdown from Activity 4 so that when an album is deleted, all of the
entries stored on the AlbumSongs table for the deleted album as well as the album. Remember that a
song may belong to more than one album, so do not delete the songs.
Activity 6: More database operations using C#
For this activity, create an interface that allows the user to select a band from a list (combo-box).
After the user selects a band and clicks on the Submit button, the interface display a list of albums
associated with that band.
o Name your application, BandName
o Construct a form containing a combo-box that is populated with the name of each band
contained in the database. Hint: Use Activity 3 as an example of how to populate the combo box.
o Add a label to the combo-box, Band Name:.
o When the Submit button is selected, query the database to retrieve and display the list of
albums associated with this band.
Question 2: Create a Windows application that should display the movement of a car using timer control.
And application should be able to play and stop the car.