String[] test = {"a","b","c"};
StringBuffer testStr = new StringBuffer();
for(int i =0;i<test.length;i++){
testStr.append(test[i]).append(",");
}
String[] test1 = {};
StringBuffer test1Str = new StringBuffer();
String test1String = "";
if(test1.length == 0){
test1String = "";
}else{
for(int i =0;i<test1.length;i++){
test1Str.append(test1[i]).append(",");
}
test1String = test1Str.substring(0, test1Str.length()-1);
}
String[] test2 = {"e","f","g"};
StringBuffer test2Str = new StringBuffer();
String test2String = "";
if(test2.length == 0){
test2String = "";
}else{
for(int i =0;i<test2.length;i++){
test2Str.append(test2[i]).append(",");
}
test2String = test2Str.substring(0, test2Str.length()-1);
}
String testString = testStr.substring(0, testStr.length()-1);
String finalString = "";
if(!testString.equals("")){
finalString += testString;
}
if(!test1String.equals("")){
finalString += ";"+test1String;
}
if(!test2String.equals("")){
finalString +=";"+test2String;
}
System.err.println(finalString);
String sql2 = "update CDS00COR set C001DWMI = '"+2+"' ,dangerstyle = '"+finalString+"' where corpkey = '"+1+"'";
System.out.println("----->"+sql2);
很简单的。自己记录下
posted on 2009-03-05 14:26
Johnhe 阅读(148)
评论(0) 编辑 收藏 所属分类:
J2SE