Osama Khalid
Osama Khalid

Reputation: 21

Search different words together

 public string getSearchResult(string qry, string options, string noOfRecords, string strrefine)
 {
     string Query = "";
     if (qry == "") return "";
     string[] qrymod = qry.Split(' ');
     if (qrymod.Length > 1)
     {
         for (int i=1; qrymod.Length > i; i++)
         {
             qry =qrymod[i];
         }
     }

     //qry = qrymod[0];
     qry = qry.Replace("\\", "\\\\").Replace("%", "\\%").Replace("_", "\\_");
     if (options == "A" || options == "AC")
        Query += " Select top " + noOfRecords + " cast(activityid as nvarchar(50)) as 'id',title as 'title',cast(description as varchar(200)) as 'desc' ,'AC' as 'Type' from searchActivity WHERE title like '%" + chkText(qry) + "%' or description like '%" + chkText(qry) + "%'  escape '\\' ";
}

I can perform search from this function but the issue is whenever i am entering the text with two words it searches the word after entering space the function will start searching the 2nd word i want to compile the search result to search both the words

Upvotes: 0

Views: 131

Answers (1)

Shane Andrade
Shane Andrade

Reputation: 2675

You want to do a full text query... Have a look here

Upvotes: 1

Related Questions