I have these columns in my table;
Categ - int
WorkPlace - int
WorkPlace1 - int
AsignedAs - int
and I am using C#
I want to select all rows with
OR
if just one of the search parameters is not equal to 0 I added a default value to know if the user is selecting from combobox or not.I want to select with AND with this sequence : if more than search parameters is not equal to 0 (user select value) some thing like this
WHERE Categ = @categ AND WorkPlace = @WorkPlace (user select two values
and the others are blank or equal to 0
or
WHERE WorkPlace = @WorkPlace AND WorkPlace1 = @WorkPlace1
or
WHERE Categ = @Categ AND WorkPlace = @WorkPlace1
(user select these values and are not blank so we add and
to the query)
and so on....
So I want check for values if are empty or not to build the right query.