我的用的语句是 
     MyView.RowFilter = "state='no' and owner="+username  ;
筛选出state为no的并且owner为username的行;username为变量
但是会报错,求教各位达人,正确的该怎么写
谢谢

解决方案 »

  1.   

    MyView.RowFilter = "state='no' and owner='"+username+"'"   username用'' 引起来 
      

  2.   

    你的username 要是是Stribg类型的就必须加单引号
    MyView.RowFilter = "state='no' and owner='"+username+"'"
    如果不是的话,你就要检查程序了
      

  3.   


    可能你数据库的字段是字符串类型的,所以需要加上单引号。代码:MyView.RowFilter = "state='no' and owner='"+username+"'";