Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Connection conexion=null;
- try{
- PreparedStatement ps = cn.prepareStatement("INSERT INTO Clientes (Nombre, Apellido, Sexo, Edad, Telefono, Peso) VALUES (?,?,?,?,?,?)");
- ps.setString(1, txtNombre.getText() );
- ps.setString(2, txtApellidos.getText() );
- ps.setString(3, comboBoxSexo.getSelectedItem().toString() );
- ps.setString(4, txtEdad.getText() );
- ps.setString(5, txtTelefono.getText() );
- ps.setString(6, txtPeso.getText() );
- int res = ps.executeUpdate();
- if (res>0){
- JOptionPane.showMessageDialog(null, "PERSONA GUARDADA");
- } else{
- JOptionPane.showMessageDialog(null, "FALLA AL GUARDAR");
- }//fin else
- conexion.close(); //cerrando la conexión
- }catch(Exception e){
- System.out.println(e);
- }//Fin TryCath
- limpiarCaja(); //Limpia el texto introducido
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement