Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to create a search first type first word then type middle word then type last word of row then again type second word of row?

like

BUTTON PLASTIC 10MM FILTER 2HOLE

I want search Button plastic Hole search exactly do work.
but i want search like (Button Hole plastic) or (button 10mm 2hole) or (2hole button 10mm) not work search or Button Filter 10MM


Simply I want to search start or ending or between any data match after space & before after first word or ending whatever search should be work.

Please Help if you know

What I have tried:

I am using Wild card in SQL for searching and implementing c#.
Posted
Updated 29-Apr-16 0:51am
Comments
Nigam,Ashish 29-Apr-16 6:50am    
can you mention your query here.
Karthik_Mahalingam 29-Apr-16 8:58am    
do as the same in old solution for similar question
http://www.codeproject.com/Answers/1096421/How-do-I-create-a-search-after-spacing-first-word#answer1

1 solution

Basically, you need to produce a separate WHERE conditionfor each word you want:
SQL
... WHERE myColumn LIKE '%Button% OR myColumn LIKE '%10MM%' OR ...
Will find all rows which contain any of the words.
The other solution would be to use a full text search, but they are more complex to set up and use: Full-Text Search[^]
 
Share this answer
 
Comments
Member 11151453 29-Apr-16 7:43am    
Exactly but do in c#
OriginalGriff 29-Apr-16 8:26am    
It's pretty much the same problem in C# - if you have it in C# collections, then have a look here:
http://stackoverflow.com/questions/3519539/how-to-check-if-a-string-contains-any-of-some-strings
Basically, there is no short cut!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900