Stmt.executeUpdate("insert into type (type_parent_id,type_name_en,type_name_cn,type_order_id) values ("+t_p_id+",'"+type_name_en+"','"+type_name_cn+"',"+new_order_id+")");
这样肯定是只能插入一条了
循环试试

解决方案 »

  1.   

    //假如要插入4条记录
    String sql="";
    for(int i=1;i<=4;i++){
        sql=sql+"insert into type (type_parent_id,type_name_en,type_name_cn,type_order_id) values ("+t_p_id+",'"+type_name_en+"','"+type_name_cn+"',"+new_order_id+")";
    }
    Stmt.executeUpdate(sql);
    这样就可以了。
      

  2.   

    同意fany_han(fany_han)的写法,必须循环嵌套,删除也是一样for语句决定你要插入的记录数目
      

  3.   

    ???
    应该是:
    for(int i=1;i<=4;i++){
        sql="insert into type (type_parent_id,type_name_en,type_name_cn,type_order_id) values ("+t_p_id+",'"+type_name_en+"','"+type_name_cn+"',"+new_order_id+")";
    Stmt.executeUpdate(sql);}
      

  4.   

    executeUpdate()后,调用 connect 对象的 commit 提交再写入新记录