select * from jobs where job_desc like '%{0}%'",this.textBox2.Text.Trim()
不是做了模糊查询吗。。

解决方案 »

  1.   

    那你先加个判断
    if(this.textBox2.Text.Trim() != "")
    {
     sql = string.Format("select * from jobs where job_desc like '%{0}%'",this.textBox2.Text.Trim()); 
    }
    else
    {
    sql = string.Format("select * from jobs" );
    }可能因为 %空格%,或者 %%
      

  2.   

    select * from jobs where job_desc like '%{0}%'
    Select * From jobs where job_desc='{0}'两处不一致
      

  3.   

    select * from jobs where job_desc like '%{0}%这不是做了模糊查找了吗
      

  4.   

    把  string sql = string.Format("select * from jobs where job_desc like '%{0}%'",this.textBox2.Text.Trim());  中的红色部分换成:
    ("select * from jobs where instr(job_desc,upper('%{0}'))>0 or instr(job_desc,lower('%{0}'))<0",this.textBox2.Trim());
    了解下like的作用就知道问题的原因所在了.
      

  5.   

    ("select * from jobs where job_desc like '%'+this.textBox2.Text.Trim()+"'%'"); 
    模式运算符没效!改改吧!
      

  6.   

    上面漏写了个"%"
    ("select * from jobs where instr(job_desc,upper('%{0}%'))>0 or instr(job_desc,lower('%{0}%')) <0",this.textBox2.Trim()); 
      

  7.   

              string sql = string.Format("select * from jobs where job_desc like '%{0}%'",this.textBox2.Text.Trim()); 
    这就是模糊查询呀!