Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void jButtonAtualizarActionPerformed(java.awt.event.ActionEvent evt) {
- String sql = "UPDATE livros SET titulo=?,cod_autor=?,cod_editora=?,ed=?, preco_livro WHERE codigo=?";
- try {
- PreparedStatement statement = livraria.connection.prepareStatement(sql);
- statement.setString(1, tfTitulo.getText());
- statement.setString(2, tfAutor.getText());
- statement.setString(3, tfEditora.getText());
- statement.setString(4, tfEd.getText()); //
- statement.setString(5, tfCodigo.getText());
- statement.setString(6, tfPreco.getText());
- statement.executeUpdate();
- JOptionPane.showMessageDialog(null, "Cadastro realizado com sucesso");
- } catch (Exception e) {
- System.out.println("O erro é o seguinte: " + e.toString());
- System.exit(0);
- }
- }
Add Comment
Please, Sign In to add comment