Click here to Skip to main content
15,894,646 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
private void loadclass()
        {
            string getclass = "select * from class";
            DataTable dt = new DataTable();
            dt = connect.select(getclass);
            comSelClass.DataSource = dt;
            comSelClass.DisplayMember = "class";
            comSelClass.ValueMember = "class_id";
            loadSection();
            loadsubject();
        }
        private void loadSection()
        {
            string getsection = "select section_id, section from section where class_id=" + comSelClass.SelectedValue.ToString();
            DataTable dt = new DataTable();
            dt = connect.select(getsection);
            comSelSection.DataSource = dt;
            comSelSection.DisplayMember = "section";
            comSelSection.ValueMember = "section_id";
        }
private void comSelClass_SelectedIndexChanged(object sender, EventArgs e)
        {
            
        }


what i want is when i change my combobox index i want section related to that class in another combobox. when i have written loadsection() function in comSelClass_SelectedIndexChanged() event i am getting an error : "Unknown column 'System.Data.DataRowView' in 'where clause'"
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900