JAVA指定データテーブルにリストセットのデータを一括挿入

5582 ワード

//dt_Sales    List  
Object[][] params_ZXHJ = new Object[dt_Sales.size()][];
for (int i = 0; i < dt_Sales.size(); i++) {
    String str1 = ((HashMap) dt_Sales.get(i)).get("   ID").toString();
    String str2 = ((HashMap) dt_Sales.get(i)).get("   ID").toString();
    String str3 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str4 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str5 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str6 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str7 = ((HashMap) dt_Sales.get(i)).get("  ").toString();
    String str8 = ((HashMap) dt_Sales.get(i)).get("  ID").toString();
    String str9 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str10 = ((HashMap) dt_Sales.get(i)).get("    ID").toString();
    String str11 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str12 = ((HashMap) dt_Sales.get(i)).get("  ID").toString();
    String str13 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str14 = ((HashMap) dt_Sales.get(i)).get("     ID").toString();
    String str15 = ((HashMap) dt_Sales.get(i)).get("     ").toString();
    String str16 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str17 = ((HashMap) dt_Sales.get(i)).get("  ").toString();
    String str18 = ((HashMap) dt_Sales.get(i)).get("   ").toString();
    String str19 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str20 = ((HashMap) dt_Sales.get(i)).get("   ").toString();
    String str21 = ((HashMap) dt_Sales.get(i)).get("   ").toString();
    String str22 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str23 = ((HashMap) dt_Sales.get(i)).get("      ").toString();
    String str24 = ((HashMap) dt_Sales.get(i)).get("      ").toString();
    String str25 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str26 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str27 = ((HashMap) dt_Sales.get(i)).get("    2").toString();
    String str28 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str29 = ((HashMap) dt_Sales.get(i)).get("      ").toString();
    String str30 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str31 = ((HashMap) dt_Sales.get(i)).get("  Code").toString();
    String str32 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str33 = ((HashMap) dt_Sales.get(i)).get("       ").toString();
    String str34 = ((HashMap) dt_Sales.get(i)).get("    /    ").toString();
    String str35 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str36 = ((HashMap) dt_Sales.get(i)).get("     ").toString();
    String str37 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str38 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str39 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str40 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str41 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str42 = ((HashMap) dt_Sales.get(i)).get("   ").toString();
    String str43 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str44 = ((HashMap) dt_Sales.get(i)).get("   ").toString();
    String str45 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str46 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str47 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str48 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str49 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str50 = ((HashMap) dt_Sales.get(i)).get("      ").toString();
    String str51 = ((HashMap) dt_Sales.get(i)).get("    ").toString();
    String str52 = ((HashMap) dt_Sales.get(i)).get("     ").toString();
    String str53 = ((HashMap) dt_Sales.get(i)).get("     1").toString();
    String str54 = ((HashMap) dt_Sales.get(i)).get("     2").toString();
    String str55 = dfDate.format(new Date());
    String str56 = UserName;
    params_ZXHJ[i] = new Object[]{str1, str2, str3, str4, str5, str6, str7, str8, str9, str10, str11, str12, str13, str14
            , str15, str16, str17, str18, str19, str20, str21, str22, str23, str24, str25, str26, str27, str28
            , str29, str30, str31, str32, str33, str34, str35, str36, str37, str38, str39, str40, str41, str42
            , str43, str44, str45, str46, str47, str48, str49, str50, str51, str52, str53, str54, str55, str56};
}
conn.setAutoCommit(false);//               false
sql = "INSERT INTO " + TableName + " VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?"
        + ",?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
batch(params_ZXHJ, sql);
public void batch(Object[][] params, String sql) {
    QueryRunner queryRunner = new QueryRunner(true);
    try {
        //  list                  
        queryRunner.batch(getConnection(), sql, params);
    } catch (SQLException e) {
        e.printStackTrace();
    }
}