|
发表于 2011-10-30 08:41:13
|
显示全部楼层
Re:object
Java code
String sqlStr = "";
String abcString="4,开,1,222,222,CJ:5,开,1,333,333,CJ:6,开,1,444,444,CJ:24,开,1,999,999,KZ:25,开,1,888,888,KZ";
String[] obj1 = abcString.split(":");
for(int i=0; i<obj1.length;i++){
Object[] obj2 = obj1.split(",");
sqlStr = "insert into xxxtable(param1,param2,param3,param4,param5,param6) values("+obj2[0]+","+obj2[1]+","+obj2[2]+","+obj2[3]+","+obj2[4]+","+obj2[5]+");";
System.out.println(sqlStr);
}
Java code
insert into xxxtable(param1,param2,param3,param4,param5,param6) values(4,开,1,222,222,CJ);
insert into xxxtable(param1,param2,param3,param4,param5,param6) values(5,开,1,333,333,CJ);
insert into xxxtable(param1,param2,param3,param4,param5,param6) values(6,开,1,444,444,CJ);
insert into xxxtable(param1,param2,param3,param4,param5,param6) values(24,开,1,999,999,KZ);
insert into xxxtable(param1,param2,param3,param4,param5,param6) values(25,开,1,888,888,KZ); |
|