Advertisement
Guest User

Untitled

a guest
Jul 29th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. PreparedStatement stl = null;
  2. ResultSet rs = null;
  3. Connection con = null;
  4.  
  5.  
  6.  
  7. public NovoJFrame() {
  8. initComponents();
  9.  
  10. IniciarBD();
  11.  
  12. this.PrencherComboBox();
  13.  
  14. jPanel3.setVisible(false);
  15. }
  16.  
  17.  
  18. public void PrencherComboBox(){
  19. String sql = "Select *from ALUNO";
  20. try {
  21.  
  22. stl = con.prepareStatement(sql);
  23. rs = stl.executeQuery();
  24.  
  25. while(rs.next()){
  26. jComboBox1.addItem(rs.getString("NOME"));
  27. }
  28. } catch(SQLException ex){
  29. JOptionPane.showMessageDialog(null,ex);
  30. }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement