Hi, i'm using sql-server 2005 with asp.net C#.
There is a search query on my site with different parameters.
fromAge as tinyint
toAge as tinyint
fromHeight as tinyint
toHeight as tinyint
gender as tinyint
withImage as bit
region as tinyint
astrologicaSign as tinyint
these parameters i get from first time use performs a search and save his search preferences in Search Table and then use them on Users Table from which i select users that meet with requirements.
Problem is that some values can be conditional like for example withImage(bit) this means that now i need to have if statement that check whether i provided 0 or 1 to withImage and then perform select ie. if withImage=1 then querie's where would be picture1<>'0' else without where condition at all.
I did end up with 10 nested if statements with initial query ( which i simplified for example sake).
Is there way to avoid it except dynamic SQL?