BindingSource is not flexible or its me - Can't do DISTINCT

Musab

Member
Joined
Apr 9, 2008
Messages
21
Programming Experience
1-3
Hi all,

Here is my problem for 3 months trying to read and search with no hope, So please any hint would be helpful,

Lets say I have 3 DropDownLists,

>Car
>Model
>year

I want the first dropdownlist to show "DISTINCT" values of the cars.

Model DDL will depend on the result of Car DDL,
year will depend on Model and Car DDL, any help how to perform this in ADO.NET

The binding source seems not to be flexible enough, because for example if I have this table

-----------------------------
CAR | Model | Year
-----------------------------
Mitsubishi | Gallant | 2003
Mitsubishi | Lancer | 2003
Mitsubishi | etc | 2003


here is what Happened

1. I see 3 Mitsubishi in DDL1, and 3 2003 in DDL3
2. I want to choose Mitsubishi from DDL1 and Gallant from DDL2 then see only one 2003 that is related to them in DDL3.

Bottom of line, this can be done using what I call "Manual connection" But I like the binding source and wish to use it to do what I want.
 
BS only makes available the data it finds in the underlying list (subject to filters and ordering). If thats what the list looks like then that is what is shown
If you have 3 DDL then you need 3 bindsource and 3 datatables containing only the data to show, probably filled using 3 separate SELECT DISTINCT queries. Additionally you can establish relations between the tables and bind the bindsource to the relation to achieve cascading comboboxes.

BINDINGSOURCE CANNOT PULL OUT ONLY DISTINCT VALUES FOR YOU FROM A SINGLE TABLE

Take a read of the DW2 link in my sig, section on displaying related data
 
Back
Top