如何实现像当当网那样的站内搜索??我做的是购书网站!!

解决方案 »

  1.   

    就是查询,你写个方法,设置一个多表的模糊查询,Jion,或者只模糊查询你的图书表,就行! 糊弄糊弄你们老板的了
      

  2.   

    这种搜索规则定制比较麻烦如果是产品多,那么肯定要用到分词,不能查数据库,查索引。。比如用lucene如果产品不多,那么定制规则比如空格是and 等等这样,然后直接查库喽
      

  3.   

     Repository.TBRepository tbrep = Repository.TBRepository.GetInstance();
               TB.TBInfoDataTable tbDT = tbrep.getTB();
               //药敏号
               string yaominId = this.textBoxymID.Text; 
                
               //菌株来源
               string laiyuan = this.comboBoxlaiyuan.SelectedItem.ToString();
                //菌株代期
               string daiqi = this.comboBoxTBdaiqi.SelectedItem.ToString();
               //菌株保存培养基
               string pyj = this.comboBox3pyji.SelectedItem.ToString();
                //菌株冰箱编号
               string fridgeID =  this.fridgeID.Text;
               //菌株保存架编号
               string jiaID = this.textBox5jiaID.Text;
                //菌株保存盒编号
               string heID = this.textBox6heID.Text;          //保存管数
               string  guanshu = this.numericUpDown1.Value.ToString ();           //入库时间
               DateTime dt = this.dateTimePickerruku.Value ;
               //入库人
               string inPeople = this.Inpeople.SelectedItem.ToString();
               //备注
               string res = this.richTextBox1.Text;           StringBuilder whereString = new StringBuilder();
               whereString.Append("1 = 1");
               if (yaominId != "")
                   whereString.Append(" and YaominID='" + yaominId + "'");             if(laiyuan != "全部")
                   whereString.Append( "and  "+"TBcause='" + laiyuan + "'");           if (pyj != "全部")
                   whereString.Append( "and  "+"TBculture='"+pyj+"'");           if (daiqi != "全部")
                   whereString.Append( "and  "+" TBdaiqi='"+daiqi +"'");           if (fridgeID != "")
                  whereString.Append( "and  "+" TBfridge='"+fridgeID +"'");           if (jiaID != "")
                   whereString.Append( "and  "+" TBjiaID='"+jiaID +"'");           if (heID != "")
                  whereString.Append( "and   "+" TBheID='"+heID +"'");           if (guanshu != "")
                   whereString.Append( "and  "+"  TBnumber='"+guanshu +"'");           //if (dt != null )
               //   whereString.Append( "and  "+ " TBindate='"+dt+"' ");           if (inPeople != "")
                  whereString.Append(" and  "+" TBinpeople='" + inPeople + "' ");
               if (res != "")
                   whereString.Append(" and  "+" TBres='" + res + "'");           DataRow[] dr = tbDT.Select (whereString.ToString ());           this.listView1.Items.Clear();
              foreach (TB.TBInfoRow item in dr)
              {
                  ListViewItem showItem = new ListViewItem();
                  showItem.Text = item.YaominID;
                  showItem.SubItems.Add(item.TBcause.ToString());
                  showItem.SubItems.Add(item.TBdaiqi.ToString());
                  showItem.SubItems.Add(item.TBculture.ToString());
                  showItem.SubItems.Add(item.TBfridge.ToString ());
                  showItem.SubItems.Add(item.TBjiaID.ToString ());
                  showItem.SubItems.Add(item.TBheID.ToString ());
                  showItem.SubItems.Add(item.TBnumber.ToString());
                  showItem.SubItems.Add(item.TBindate.ToString());
                  showItem.SubItems.Add(item.TBinpeople);
                  showItem.SubItems.Add(item.TBres);
                  showItem.Tag = item;              listView1.Items.Add(showItem);          }
              
    我是从内存表中查询出的数据显示在listview上  但愿对你有用
      

  4.   

    即private DataTabel GetData(string sname)
    {
        string str="select * from dtTest where sname like '%"+sname+"%'";
        sqlDataAdapate da=new sqlDataAdapate();
        DataTable dt=new DataTable();
        da.Fill(dt);
        return dt;
    }
    用一页面显示该DataTable的内容即可!
      

  5.   


    用一个页面显示此DataTable的内容即可!
      

  6.   

    多参数的处理方法
    比如文本框2个,一个输UserName,一个输UserPass
    StringBuild sb = new StringBuild();
    if(!String.isnullorEmpty(txtUserName.Text))
    {
      sb.Append(" and UserName ='").Append(txtUserName.Text).Append("'");
    }
    if(!String.isnullorEmpty(txtUserPass.Text))
    {
      sb.Append(" and UserPass ='").Append(txtUserPass.Text).Append("'");
    }
    然后条件就是sb.toString()
      

  7.   

    <p>This site has your answer, click Connect:<a href="http://www.christianlouboutinonstore.com"><strong>louboutins shoes</strong></a> </p>
      

  8.   

    This site has your answer, click Connect:louboutins shoes