Advertisement
JacksonBarbosa

Untitled

Oct 30th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1. public void inserir(CampiBean campi) {
  2.         String query = "INSERT INTO campi (nome, cod_admin) VALUES (?, ?)";
  3.         PreparedStatement ps;
  4.  
  5.         try {
  6.             ps = con.prepareStatement(query);
  7.             ps.setString(1, campi.getNome());
  8.             ps.setInt(2, campi.getCodAdmin());
  9.             ps.execute();
  10.             new Alert("Cadastro realizado com sucesso!", 2).iniciaJanela();
  11.         } catch (SQLException ex) {
  12.             new Alert("Erro: " + ex.getMessage(), 2).iniciaJanela();
  13.         }
  14.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement