HashTable实例 public class HashTable_msg { public HashTable_msg() { String sum_sql="select mobilenum,count(*) from SJSJ_Msg where (left(in_date,6)=(select left(CONVERT(varchar(12) , getdate(), 112 ),6)))group by mobilenum" Hashtable<String,Integer> ht = new Hashtable<String,Integer>() try{ ResultSet rs= DBAccess.getInstance().select(sum_sql) while(rs!=null) { ht.put(rs.getString(1),rs.getInt(2)) rs.next() } } catch (Exception e) { Logs.printError(e) } } }