public java.util.ArrayList<java.util.Hashtable<String, String>> UserList() {
ArrayList<Hashtable<String, String>> list = new ArrayList<Hashtable<String, String>>();
String sql = "Select * from user where Deleted=0 order by orderby";
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
try {
con = DBConnection.getConnection();
stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_READ_ONLY);
rs = stmt.executeQuery(sql);
while (rs.next()) {
Hashtable<String, String> user = new Hashtable<String, String>();
user.put("autoID", String.valueOf(rs.getInt("id")));
user.put("UserName", rs.getString("UserName")+""); //如果数据为null的时候就会出错,所以加+""
user.put("realName", rs.getString("RealName")+"");
user.put("email", ""+rs.getString("Email"));
user.put("qq", ""+rs.getString("QQ"));
user.put("addr", ""+rs.getString("Addr"));
user.put("tel", ""+rs.getString("tel"));
list.add(user);
}
} catch (final Exception e) {
} finally {
try {
if (rs != null)
rs.close();
if (stmt != null)
stmt.close();
DBConnection.freeConnection(con);
} catch (final Exception ex) {
}
rs = null;
stmt = null;
con = null;
}
return list;
}