代码如下:string sTypes="select * from FileView where FirstType like '"%'+sfirstType+'%"' and SecType like '"%'+ssecType+'%"' and FileTitle like '"%'+sTitle+'%"'";
是不是“”与‘’用得太频繁了?

解决方案 »

  1.   

    有错误
    string sTypes="select * from FileView where FirstType like '"%'+sfirstType+'%"' and SecType like '"%'+ssecType+'%"' and FileTitle like '"%'+sTitle+'%"'";
    字符从第一个"起始,再遇到"终止
    "select * from FileView where FirstType like '"
    是一个完整字符串,后面的%不是字符串运算符,错误
      

  2.   

    string sTypes="select * from FileView where FirstType like '%"+sfirstType+"%' and SecType like '%"+ssecType+"%' and FileTitle like '%"+sTitle+"%'";
      

  3.   

    正确的应该是这样:
    string sTypes="select * from FileView where FirstType like '%"+sfirstType+"%' and SecType like '%"+ssecType+"%' and FileTitle like '%"+sTitle+"%'";