Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. public void listarAssociadosnoComboboxV() throws Exception {
  2. try {
  3.  
  4. Cad_Veiculo.cmbfk_associadoV.addItem("SELECIONE");
  5. String sql = "SELECT ID_ASSOCIADO, NOME FROM ASSOCIADO";
  6.  
  7.  
  8.  
  9. preparedStatement = (PreparedStatement) conexao.prepareStatement(sql);
  10. rs = preparedStatement.executeQuery();
  11. while (rs.next()) {
  12. Associado a = new Associado();
  13. a.setIdAssociado(rs.getInt("ID_ASSOCIADO") );
  14. a.setNome( rs.getString("NOME") );
  15. Cad_Veiculo.cmbfk_associadoV.addItem(a) ;
  16. }
  17. } catch (SQLException sqlEx) {
  18. }finally {
  19. Conexao.closeConnection(conexao, preparedStatement);
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement