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

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

4

1 回答 1

1

你想做一个全文查询...看看这里

于 2013-01-15T06:28:59.953 回答