Guest User

Untitled

a guest
Nov 20th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. public void theQuery(String query) {
  2. Statement statement = null;
  3. Connection connection = null;
  4.  
  5. try {
  6. connection = DriverManager.getConnection("jdbc:sqlserver://localhost/PROGRAII","root","");
  7. statement = connection.createStatement();
  8. statement.executeUpdate(query);
  9. JOptionPane.showMessageDialog(null, "Se realizó la operación");
  10. }
  11. catch (Exception ex) {
  12. JOptionPane.showMessageDialog(null, "NO se realizó la operación");
  13. }
  14. }
  15.  
  16. private void jButAceptar_actionPerformed(ActionEvent e) {
  17. try {
  18. inserta.theQuery("insert into ControlAcceso(cedula,email,clave) values('"+this.jTexCedula.getText()+"'," + ","+this.jTexEmail.getText()+"','"+this.jTexClave.getText()+"')"); } catch (Exception ex) {
  19. JOptionPane.showMessageDialog(null, "No se realizo el query"); }
Add Comment
Please, Sign In to add comment