Advertisement
andresdiaz

metodo

Jan 10th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. public ArrayList<Ingresar> mostrarUsuarios(){
  2. try {
  3. ArrayList<Ingresar>Usuarios = new ArrayList<Ingresar>();
  4. String sql = "select * from ingresar;";
  5. Statement st = cn.createStatement();
  6. ResultSet rs = st.executeQuery(sql);
  7.  
  8.  
  9. while (rs.next()) {
  10. Ingresar usuarios = new Ingresar();
  11. usuarios.setId(rs.getInt("id"));
  12. usuarios.setUsuario(rs.getString("usuario"));
  13. usuarios.setPassword(rs.getString("password"));
  14. usuarios.setRol(rs.getString("rol"));
  15. Usuarios.add(usuarios);
  16.  
  17. }
  18. return Usuarios;
  19.  
  20.  
  21.  
  22.  
  23. } catch (SQLException ex) {
  24. Logger.getLogger(Conexion.class.getName()).log(Level.SEVERE, null, ex);
  25. }
  26. return null;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement