Hi Vanessa,
your problem is a common problem and I'm wonderng that nobody has responded to you. The solution is simple, if I got it correctly.
Let's say you want to have two combo boxes, one with Salesman's and the second one with Customers which belong to the selected salesman in the first combo box. To fullfill this you will need one DataSet called dsSales. For both ComboBexes you will need one BindingSource for each: bindingSourceSalesman and bindingSourceSalesmanCustomers. Your dataset has to contain two data tables tableSalesman and tableSalesmanCustomers where salesman has been filld from sql statement like
"select salesmanId, salesmanName from salesman"
and the second one
"select salesmanid, customerId, customerName from customers c inner join salesmanXcustomers s on c.salesmanId = s.salesmanId"
So, after filling your DataTables and adding them to the dsSales you need to add foreign key relations between those two DataTables on a salesmanId (note that you have it on both tables). Assume name of this relations is "FK_Salesman_X_Customers"
Next steps are related to the BindongSources. We are telling them what and how to bind.
bindingSourceSalesman.DataSource = dsSales; //your DataSet
bindingSourceSalesman.DataMember = "tableSalesman"; //name of the table - string
The second one, bindingSourceSalesmanCustomers will have as DataSource our bindingSourceSalesman, not our DataSet dsSales and DataMember will not be set to any table but to the foreign key relations name you set between these two tables.
bindingSourceSalesmanCustomers.DataSource = bindingSourceSalesman;
bindingSourceSalesmanCustomers.DataMember = "FK_Salesman_X_Customers";
On this way, once you are changing selection to comboBoxSalesman available values will be updates in comboBoxSalesmaCustomers.
Hope this helps.
Best regards,
Best regards,
dlm@bypsoft
Compare SQL Server, MySQL and Oracle for free - DBTyP.NET
www.bypsoft.com