I have two combobox, which is 'names' and 'types' and it's being populated by a dataset. It contains an additional item "-- ALL --" to indicate that all items of a particular field are being shown. I have an SQL select statement to filter the records according to the selected item of the two combobox. I used a select statement to bind the records to a datagridview with regards to the selected items.
SELECT * FROM table where name = ddlnameselecteditem AND type = ddltypeselecteditem
The problem now is when I select a name from the names combobox and types combobox has a selection of -- ALL --, there would be no return records because there's no such thing as '-- ALL --' record in column 'types' i'm querying. I need to display rows of the selected 'name' while still showing all the 'types'. How could I achieve this? I think I need to avoid the '-- ALL --' item from the combobox. I'm quite confused, really.