good morning,
i have created a winform that search with multiple criteria , and each criteria has a checkbox to decide to u choose this criteria or not.
my question is how to write the query??? so that it works fine if one checkbox is selected or 2 or more.
thanks
Loading

Mamta MRank #268 · 9.4K reputationPosted Dec 26, 2011, 1:20 AM EST
Consider an example.
Assuming that you want to search for all candidates having qualification as MCA, or name containing Nicole, or a id less than or equal to 100, you can write the query as below:
SELECT candidateId, Name, Address, qualification
FROM Candidates where qualification='MCA' OR Name LIKE 'Nicole%' OR candidateId<=100
sara lion5 reputationPosted Dec 27, 2011, 8:16 PM EST
i did many if s ans select queries ,which works but not always .:(
Mamta MRank #268 · 9.4K reputationPosted Dec 27, 2011, 8:25 PM EST
Can you show what code you are using so far?
-Mamta
sara lion5 reputationPosted Dec 28, 2011, 8:00 AM EST
hi mamta ,
i know my solution is not professional , below are my codes ,thanks a lot .
using (SqlConnection cn = new SqlConnection(Common.ConnectionString))