dreamer610
MIS
Hi,
I need some help with creating an SQL query of data in an Access database. I have an ASP.net page which has a text box that users can enter keywords in. When the user clicks a Search button, the page queries an Access database which has a keywords field.
The code I have is this
SELECT * FROM tblGallery
WHERE Keywords LIKE '%" & strSearch &"%' AND ShowDate <=Date()
The value that is stored in the strSearch variable is the value that was entered in the search textbox.
This query works, but not exactly how I want it to. I want to be able to enter two or more words, which are not (necessarily)next to each other in the database field, and still have it return that row. For example, a user should be able to enter "beach sand" in the text box and get a hit even though the keyword field has "beach ocean sand" in it. Similarly I would want them to be able to enter "sand beach" and still get a hit. I understand why my SQL statement isn't working how I want it to, but I don't know how to correctly word it. Thanks in advance.
I need some help with creating an SQL query of data in an Access database. I have an ASP.net page which has a text box that users can enter keywords in. When the user clicks a Search button, the page queries an Access database which has a keywords field.
The code I have is this
SELECT * FROM tblGallery
WHERE Keywords LIKE '%" & strSearch &"%' AND ShowDate <=Date()
The value that is stored in the strSearch variable is the value that was entered in the search textbox.
This query works, but not exactly how I want it to. I want to be able to enter two or more words, which are not (necessarily)next to each other in the database field, and still have it return that row. For example, a user should be able to enter "beach sand" in the text box and get a hit even though the keyword field has "beach ocean sand" in it. Similarly I would want them to be able to enter "sand beach" and still get a hit. I understand why my SQL statement isn't working how I want it to, but I don't know how to correctly word it. Thanks in advance.