public List queryUserList() throws SQLException {
String sql="select * from userInfo";
//获取查询结果集
ResultSet rs=db.query(sql);
List<UserInfo> list=new ArrayList<UserInfo>();
while (rs.next()) {
UserInfo user=new UserInfo();
user.setId(rs.getInt(rs.getString("id")));
user.setUserName(rs.getString("userName"));
user.setSex(rs.getString("sex"));
user.setEmail(rs.getString("email"));
user.setRegTime(rs.getString("regTime"));
list.add(user);
}
return list;
错误在user.setId(rs.getInt(rs.getString("id")));应该为user.setId(rs.getInt("id"));