Lab 12
comp 125-609, Goldwasser
Tuesday, 23 November 1999

Purpose: Introduction to Databases
Today's lab is designed to help you learn how to use the Data Control and data-aware controls discussed in chapter 5.3 of the text.

Before beginning the lab, you will want to save the file www.cs.luc.edu/~mhg/comp125/labs/MEGACTY1.MDB to a local disk.

There are two parts to today's lab.

  • Do the Data Control Walkthrough on page 277 of the text.
  • Add to your program a feature which allows you to create a list box containing all cities from the database which are in a particular country chosen by the user. (see below for details)

  • For the second part of the lab, you should specifically add the following controls to the form: a textbox and label which will be used for allowing the user to specify the country of interest; a command button captioned "Get Cities from this country", and a List Box, initially empty.

    When the user clicks on the new command button, you are to use runtime code to walk through the database, looking for records which match the indicated country. For those records that match, you should add the city name to the listbox.

    Note: You should use listbox.Clear before each time to reset the listbox to empty.

    Note: Keep in mind that testing if (string1=string2) is a case-sensitive test, so "USA" would not match "usa". If you want to make it easier on the user, you can instead test if (Ucase(string1)=Ucase(string2)), testing upper-case copies of the string.


    Test your program on "China" -- did you get three cities? Also, test your program on other countries from the database, and even on countries which are NOT in the database.
    Still have some extra time?

    When a search turns up no cities, rather than leave the listbox empty, insert the word "None" in the list.


    This lab is due before leaving class today. When you have completed te program, please call me over to your computer to test it.