Hi
I am using asp .net web form search in c#, for example with fields: - name - fruit
I want to write a sproc that can search name or fruit. If I knew that both would have values, I would pass two parameters into the sproc and would write:
Select * from myTable where name =@name and fruit = @fruit
However sometimes, either name or fruit could be empty. Without writing a separate search for fruit and name. How would I achieve this?
I would prefer not to create a dynamic query if possible, but if this is the only way how would I write it?