我有一个表结构(keywords)如下:    ID     title
    1      5S管理
    2      5S实施
    3      爱立信
    4      安达信
    5      安全管理    
这个表大概有7000的关键词
我想实现的功能是:添加一篇文章时,点击获取关键词按钮,会自动的去keywords的title字段里去找,把keywords的所有关键词能匹配查找出来,应该怎么实现?怎么写这个SQL语句啊?

解决方案 »

  1.   

    SQL啊。。去SQL版问问吧
    charindexC#关键字存持久化介质中,系统启动后读入内存。加过滤器,对每一提交,用正则进行匹配算法或者这种
    在网站后台设置过滤字符
    void Application_BeginRequest(object sender, EventArgs e)
    {
      for (int i=0; i < Request.Form.Count;i++)
      {
      if (Request.Form[i].ToString() == "__VIEWSTATE") continue;
      if (IsM(Request.Form[i].ToString()))
      {
      Response.Write("您提交的内容中含有非法字符.");
      Response.End();
      }  }  
    }
    protected bool IsM(string InText)
    {
      string word = @"";
      if (InText == null)
      return false;
      if (Regex.IsMatch(InText,word))
      return true;
      return false;
    }  
    Regex.Replace
    数据库,XML,List都可保存
      

  2.   

    模糊查询
    string keyWord=TextBox1.Text.Trim();
    string sql="select * from keywords where title like '%"+keyWord+"%'";精确查询
    string keyWord=TextBox1.Text.Trim();
    string sql="select * from keywords where title='"+keyWord+"'";