public static List<Map<String, Object>> toListMap(ResultSet ret) throws SQLException{
List<Map<String, Object>> list = new ArrayList();
ResultSetMetaData meta = ret.getMetaData();
int cot = meta.getColumnCount();
while(ret.next()) {
Map<String, Object> map = new HashMap();
for(int i = 0; i < cot; i++) {
map.put(meta.getColumnName(i + 1), ret.getObject(i + 1));
}
list.add(map);
}
return list;
}
ResultSet 轉List
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.