一起搜索不同的单词

时间:2013-01-15 06:26:25

标签: c# asp.net web-applications

 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 '\\' ";
}

我可以从这个功能执行搜索,但问题是每当我输入带有两个单词的文本时 它在输入空格后搜索单词,该功能将开始搜索第二个单词 我想编译搜索结果以搜索单词

1 个答案:

答案 0 :(得分:1)

您想要进行全文查询...看看here