Guest User

Untitled

a guest
Feb 9th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. public void modificarCliente(){
  2.  
  3. Connection miConexion;
  4.  
  5. Statement st;
  6.  
  7. try {
  8. miConexion=DriverManager.getConnection
  9. ("jdbc:mysql://localhost:3306/fastfoodcompany","root", "quepasachavales3");
  10.  
  11. st=miConexion.createStatement();
  12.  
  13. Nombre=modificarcliente.getTxtNombre().getText();
  14. Apellido1=modificarcliente.getTxtSegundoApellido().getText();
  15. Apellido2=modificarcliente.getTxtSegundoApellido().getText();
  16. id=0;
  17.  
  18.  
  19. String query="UPDATE clientes SET id= '"+ id +"' AND Nombre= '"+ Nombre +"' AND Appelido1 = '"+ Apellido1 +"' AND Apellido2 = '"+ Apellido2 +"'";
  20.  
  21. st.executeUpdate(query);
  22.  
  23.  
  24. JOptionPane.showInputDialog(null, "Datos actualizados");
  25. } catch (SQLException ex) {
  26. Logger.getLogger(bdFFC.class.getName()).log(Level.SEVERE, null, ex);
  27. JOptionPane.showInputDialog(null, "No se han podido actualizar los datos"+ex);
  28. }
  29. }
Add Comment
Please, Sign In to add comment