日期:2014-05-16 浏览次数:20378 次
conn = getConnection(); pstmt = conn.prepareStatemen(sql); pstmt.setString(1, id); rs = pstmt.executeQuery(); while(rs.next()){ list.add(rs.getString(1)); } StringBuffer sb = new StringBuffer(); //用一个StringBuffer 方法来进行遍历拼接 Iterator it = list.iterator(); boolean isNull = it.hasNext(); while (isNull) { Object o = it.next(); sb.append(String.valueOf(o)); if (isNull) { sb.append("; "); } } return sb;//拼接的结果