Keyword search

Asked By Howard Lepolstat
20-Nov-09 07:17 PM
Earn up to 0 extra points for answering this tough question.

I am trying to give users a simple keyword search. The table to be searched has five fields, both text and memo data type. There are few enough records (less than 5000) so that the lack of indexing capability (for the memo field) is not really a problem. I want to give the user the ability to enter a keyword and have it search all five fields. The search return to the user will be a two field table. The first field in the return table will be the complete data from one of the five original fields. The second field in the return table will be the name of the field in the original table in which the keyword was found.

The typical user is expected to have very little computer familiarity other than "point & click" and entering a word or two in a text field.

Since I have never created this complex a query before, I would appreciate some feedback as to the general process that might be used. Any suggestions are appreciated. Thanks.

  re

Web Star replied to Howard Lepolstat
20-Nov-09 10:06 PM

u just take input of keywork and pass create a select statement with like key on all five field then u will be get desired row

SqlDataAdapter1.SelectCommand.CommandText = "SELECT ID, Question, Answer FROM table Where field1 LIKE '%" & txtkeyword.Text & "%'" & " OR field2 LIKE '%" & txtkeyword.Text & "%'" & " OR field3 LIKE '%" & txtkeyword.Text & "%'" " or field LIKE '%" & txtkeyword.Text & "%'" & " OR field4  LIKE '%" & txtkeyword.Text & "%'"

Create New Account