仿Google的搜索下拉框
Class.ExecSQL("Update T_SearchReault Set searchcount=searchcount+1 Where tagword=''" + word.Replace("''", "''''") + "''"); } } [AjaxPro.AjaxMethod] public DataSet SearchTxt(string txt) { string Sql = @"select top 10 s.tagword,count(t.treename) result from T_SearchReault s left join T_Tree t on s.tagword=t.treename "; string order = @" group by s.tagword,s.searchcount order by s.searchcount desc"; if(txt.Trim()!=""){ Sql += " Where "; } string[] s_a = txt.Replace("''","''''").Split(new char[] { '' '' }); foreach (string s in s_a) { if (s != "") { Sql += " s.tagword like ''%" + s.ToString() + "%''"; } } Sql += order; DataSet ds = DBClass.getDataSet(Sql, "tb"); return ds; } protected void bt_search_Click(object sender, EventArgs e) { AddSearchWord(tb_search.Text); } } sql数据库: create table T_SearchReault( CREATE TABLE [dbo].[T_Tree] ( )
|
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |