I have 2 tables:
tblCountries(country_id int(4) Identity PK, country_name varchar(30))
tblCities(city_id int(4) Identity PK, city_name varchar(30), country_id int(4) FK)
I am loading all the country names from tblCountries in a combo box.
I want when the user selects a particular country from the combo, the cities associated with that country should appear in another combo box (from tblCities through PK-FK relationship)
Now, If the country id's were loaded in the countries combo, then on SelectedIndexChanged of countries combo, I can easily look up the selected item in tblCities to find the city name against that country_id. The problem is, when I load the country names in the combo, then, on SelectedIndexChanged event of countries combo, how should i load the city names in the cities combo ?
One solution is to first look up the id against a country name in countries table, then use that id as a lookup in cities table
which i think is not a good logic. PLZ HELP!
2007-03-12
06:41:13
·
3 answers
·
asked by
Anonymous
in
Computers & Internet
➔ Programming & Design