示例#1
0
        public static string Get_Searchquery(string keywords)
        {
            try
            {
                if (string.IsNullOrEmpty(keywords)) return "";

               // string[] arr_keyword = CFunctions.analys_keyword(keywords);
                string[] arr_keyword = new string[1];
                arr_keyword[0] = keywords;
                string template = "(A.forsearch LIKE '%$VAR_KEYWORD$%')";
                string vlreturn = "";
                SqlHelper helper = new SqlHelper();
                for (int i = 0; i < arr_keyword.Length; i++)
                {
                    string keyword = helper.sqlEscape(CFunctions.to_nonunicode(arr_keyword[i]));
                    if (keyword == "") continue;
                    string item = template.Replace("$VAR_KEYWORD$", keyword);
                    if (i < arr_keyword.Length - 1)
                        vlreturn += item + " OR ";
                    else
                        vlreturn += item;
                }
                return vlreturn;
            }
            catch
            {
                return "";
            }
        }