예제 #1
0
 public List<UserForm> getAllUser() {
   List list = new ArrayList();
   String sql = "SELECT * FROM Mt_User";
   ResultSet rs = db.executeQuery(sql, null);
   try {
     while (rs.next()) {
       UserForm uf = new UserForm();
       uf.setUid(rs.getInt(1));
       uf.setUsername(rs.getString(2));
       uf.setPassword(rs.getString(3));
       uf.setCity(rs.getString(4));
       uf.setEmail(rs.getString(5));
       uf.setMobile(rs.getString(6));
       uf.setUmoney(rs.getString(7));
       uf.setAdminister(rs.getString(8));
       uf.setDate(rs.getString(9));
       list.add(uf);
     }
   } catch (SQLException e) {
     e.printStackTrace();
   } finally {
     db.closeAll();
   }
   return list;
 }
예제 #2
0
 public UserForm getUser(int id) {
   String sql = "SELECT * FROM Mt_User WHERE uid = " + id + " ";
   UserForm uf = null;
   ResultSet rs = db.executeQuery(sql, null);
   try {
     if (rs.next()) {
       uf = new UserForm();
       uf.setUid(rs.getInt(1));
       uf.setUsername(rs.getString(2));
       uf.setPassword(rs.getString(3));
       uf.setCity(rs.getString(4));
       uf.setEmail(rs.getString(5));
       uf.setMobile(rs.getString(6));
       uf.setUmoney(rs.getString(7));
       uf.setAdminister(rs.getString(8));
       uf.setDate(rs.getString(9));
     }
   } catch (SQLException e) {
     e.printStackTrace();
   } finally {
     db.closeAll();
   }
   return uf;
 }