sqlcommand.CommandText = "select * from Project_Table where Project_Status like '%' and Project_Applicant like '%' and PSubject_Classification like '%' and Project_Sort like '%'";
我这样查询不出记录。
如果把and改成or就可以出记录。
这是咋回事?

解决方案 »

  1.   

    like '%'  把null过滤掉了
     明白了吧?
      

  2.   

    select * from Project_Table where Project_Status is null or Project_Applicant is null or PSubject_Classification is null or Project_Sort is null看看里面有没有你要的数据,有的话你上面的AND就查出不来
      

  3.   

    select * from Project_Table 
      

  4.   

    那我既想用like='%' 又想不过滤null
    该怎么做呢?
      

  5.   

    select * 
    from Project_Table 
    where isnull(Project_Status ,'') like '%' 
    and isnull(Project_Applicant,'') like '%'
     and isnull(PSubject_Classification,'') like '%'
     and ISNULL( Project_Sort,'') like '%'
      

  6.   

    select * 
    from Project_Table 
    where isnull(Project_Status ,' ')       like '%' 
    and isnull(Project_Applicant,' ')       like '%'
    and isnull(PSubject_Classification,' ') like '%'
    and isnull( Project_Sort,' ')           like '%'
      

  7.   

    就一个 like '%' 是什么意思