Click here to Skip to main content
11,803,861 members (78,736 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# SQL combobox
I would like to make like 4 comboboxes where each list within the combobox derives from the previous one. I thought this would be as easy as setting each box to a variable and then using that variable in the query for the combobox after it. I have attempted to use a variable in the query editor in the fillby, and also attempted to use code like this:
            using (SqlConnection cs = new SqlConnection(
@"Data Source=100-olkj-900-ptalog=Report;Persist Security Info=True;User ID=reports;Password=password
                using DataAdapter da = new SqlDataAdapter(query
                    // 3
                    DataTable t = new DataTable();
                    // 4
                    // Render data onto the screen
                    comboBox1.DataSource = t; // <-- From your designer
                    comboBox1.DisplayMember = "station.stationipaddress";
                    comboBox1.ValueMember = "station.stationipaddress";

I am not really sure, what to try...
Any ideas anyone >?
Posted 16-Jan-13 17:05pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Hello Prevatt, This link will help u surely. For this purpose we can use cascading drop downs, these are also so-called dependancy drop downs while loading the consequent drop down it wont effect the entire page i.e, updates only the partial page or specific drop down. Try this code[^]

Happy Coding....

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

  Print Answers RSS
0 OriginalGriff 450
1 CPallini 320
2 F-ES Sitecore 240
3 Sergey Alexandrovich Kryukov 234
4 CHill60 220
0 OriginalGriff 3,000
1 Maciej Los 1,910
2 KrunalRohit 1,862
3 CPallini 1,755
4 Richard MacCutchan 1,187

Advertise | Privacy | Mobile
Web02 | 2.8.151002.1 | Last Updated 16 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100