rs = stmt.executeQuery(new_cxyj);
ResultSetMetaData rsma = rs.getMetaData();
int size = rsma.getColumnCount();
JSONArray arr = new JSONArray();
while(rs.next()){
JSONObject obj = new JSONObject();
for (int i = 1; i <= size; i++) {
String s = rs.getString(rsma.getColumnName(i)) == null?"":rs.getString(rsma.getColumnName(i));
if(s==null||"".equals(s)){
s="无";
}
obj.put(rsma.getColumnName(i), s);
}
arr.add(obj);
}

posted on 2016-03-18 10:23  来临  阅读(400)  评论(0编辑  收藏  举报