ResultSet resultset2 = statement.executeQuery("select id from cusinfo where class='"+classname+"' and '"+list.get(i)+"'='"+condition[i]+"'");numofattib = resultset2.getRow();从表上看若i=1时numofattib = 2,为什么运行结果是numofattib = 0?

解决方案 »

  1.   

    ("select id from cusinfo where class='"+classname+"' and '"+list.get(i)+"'='"+condition[i]+"'"); 拼接
      

  2.   

    ResultSet resultset2 = statement.executeQuery("select id from cusinfo where class='"+classname+"' and '"+list.get(i)+"'='"+condition[i]+"'");这里and '"+
    多了个'吧
    ResultSet resultset2 = statement.executeQuery("select id from cusinfo where class='"+classname+"' and "+list.get(i)+"'='"+condition[i]+"'");
    这样
      

  3.   


    ResultSet resultset2 = statement.executeQuery("select id from cusinfo where class='"+classname+"' and '"+list.get(i)+"'='"+condition[i]+"'"); 这里and '"+ 
    多了个'吧 
    ResultSet resultset2 = statement.executeQuery("select id from cusinfo where class='"+classname+"' and "+list.get(i)+"'='"+condition[i]+"'"); 
    这样
      

  4.   


    ResultSet resultset2 = statement.executeQuery("select id from cusinfo where class='"+classname+"' and '"+list.get(i)+"'='"+condition[i]+"'"); 这里and '"+   和    +"'='      
    多了个'吧 
    ResultSet resultset2 = statement.executeQuery("select id from cusinfo where class='"+classname+"' and "+list.get(i)+"='"+condition[i]+"'"); 
    这样
      

  5.   

    如果list.get(i)是想作为字段名拼接的话就如楼上所说将“‘”去到。