Guest User

Untitled

a guest
Nov 7th, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. try{
  2.  
  3. String selected = fechainicial.getItemAtPosition(pos).toString();
  4.  
  5.  
  6. String emp = empdisp.getSelectedItem().toString();
  7.  
  8.  
  9. Connection conectar = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databaseName=GladiatorSecurityProyecto;user=sa;password=123456789;");
  10.  
  11. String guardarServicios = "INSERT INTO [dbo].[Servicios]"+"([NroServicio],[NroCliente],[FechaInicio], [FechaFin],[Tipo],[Celular],[Licencia],[Arma],[Fulltime],[MejorArteMarcial])VALUES"
  12. + "("+"'"+cedula+"','"+nombreE+"','"+apellidoE+"',"+direccionE+",'"+email+"','"+ celular+"','"+ licencia +"','" +arma+"','"+fulltime+"', '" +espe+")";
  13.  
  14. Statement statement = conexion.createStatement();
  15.  
  16. statement.executeUpdate(guardarServicios);
  17.  
  18. conexion.close();
  19.  
  20. JOptionPane.showMessageDialog(null,"El empleado ha sido ingresado correctamente");
  21.  
  22. } catch (Exception ex){
  23.  
  24. JOptionPane.showMessageDialog(null, "Ha ingresado datos incorrectos, ingreselos nuevamente");
  25. }
Add Comment
Please, Sign In to add comment