/**
* 把ResultSet转化成map对象
* @param rs
* @return
* @throws SQLException
*/
public Map<String, String> Result2Map(ResultSet rs)
throws SQLException {
Map<String, String> hm = new HashMap<String, String>();
ResultSetMetaData rsmd = rs.getMetaData();
int count = rsmd.getColumnCount();
if(rs.next()) {
for (int i = 1; i <= count; i++) {
String key = rsmd.getColumnName(i);
String value = rs.getString(i);
hm.put(key, value);
}
return hm;
}
return null;
}
▄█▀█●各位老铁,如果我的代码能够帮助到你,请给我一个赞吧!