I have made a window application using Visual Studio2008,C#,MS Access database.
In my application there are three tables "country","state","person" .On the form,there are 2 comboboxes one for "country" and other is for selecting "state" , also a textbox for entering the name of a person for each country-state pair.
Now I want that when I select any particular country from combobox1, then the corresponding states should display in combobox2 (not all states) i.e value of combobox2 depends upon the value of combobox1. Now for this country-state pair I have add the name of a person to the database.
For each combobox I have set the dataset, Display source, display member and value member in design view.
And for filling values in two combobox ,I have made two functions - "country_combo()" and "state_combo()". The code is as follows:
private void country_Combo()
{
cls_Con.comboFill(this.com_Country, "select * from country", "country", "c_name", "c_id");
}
private void state_Combo()
{
cls_Con.comboFill(this.com_State, "select * from [state] ", "[state]", "st_name", "st_id");
}
But my code is not working , its displaying all the states .
How can I load only those states(in combobox2) that corresponds to the country that is selected (in combobox1).:pretty: