Avatar of Ali Shah
Ali Shah
Flag for United Kingdom of Great Britain and Northern Ireland asked on

How to create a search criteria with option to narrow your search

Hi there,

I have got a postcodes table which contains the postcodes and the street(s) associated with it. I have got a child table which contains the full address of a business, a commercial building or residential building etc.
My reuirement is that on asp.net the users can enter the post code and all the addresses associated with that post code should be displayed. Which is very easy to achieve. But the problem comes when users try to search a specific business with in that postcode.
For example the criteria can be
Search me a macdonalds in SK4  1BS or search me macdonalds and pizza hut in SK4 1BS and the list of the businesses can expand in search criteria.

Can you please help how do i achieve this? as i am confused that in my stored procedure i can not give here an and condition in where clause because the user can leave the business field blank.

The fron end asp.net has also got a plus button to add more text boxes to be included in search criteria. But all the text boxes will only allow to enter the business.

Best regards,
Microsoft SQL Server 2005ASP.NETC#

Avatar of undefined
Last Comment
Sara bhai

8/22/2022 - Mon
jogos

where business like '%'+isnull(@searchstring,'')+'%'
ASKER CERTIFIED SOLUTION
Haver Ramirez

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Sara bhai

if you need search field to be blank for particular column then in where clause specify the condition like below

WHERE column_Name = CASE WHEN @para_column_name NOT NULL THEN para_column_name ELSE  column_Name END
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck