private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {
int fila = jtbHtMedicos.getSelectedRow();
if(fila >= 0){
jtbHtMedicos.getValueAt(fila, 0).toString();
jtbHtMedicos.getValueAt(fila,1).toString();
jtbHtMedicos.getValueAt(fila, 2).toString();
jtbHtMedicos.getValueAt(fila,3).toString();
}
else{
JOptionPane.showMessageDialog(null, "fila no seleccionada");
}
String valorMatricula = jtbHtMedicos.getValueAt(fila, 0).toString();
String valorDiaTrabajo = jtbHtMedicos.getValueAt(fila,1).toString();
String valorHoraEntrada = jtbHtMedicos.getValueAt(fila, 2).toString();
String valorHoraSalida = jtbHtMedicos.getValueAt(fila,3).toString();
try {
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); //("HH:mm:ss a")
String SQL = "UPDATE horariosdetrabajo SET `horaDeSalida`= ? WHERE `matricula`= ? AND `diaTrabajoSemanal`= ? AND `horaDeEntrada`= ?";
PreparedStatement ps = conn.prepareStatement(SQL);
ps.setInt(1, Integer.parseInt(valorMatricula));
ps.setString(2, valorDiaTrabajo);
ps.setTime(3, new java.sql.Time(formatter.parse(valorHoraEntrada).getTime()));
ps.setTime(4, new java.sql.Time(formatter.parse(valorHoraSalida).getTime()));
ps.executeUpdate();
mostrarDatos();
} catch (ParseException ex) {
Logger.getLogger(AbmMedico.class.getName()).log(Level.SEVERE, null, ex);
} catch (SQLException ex) {
Logger.getLogger(AbmMedico.class.getName()).log(Level.SEVERE, null, ex);
} catch (ClassNotFoundException ex) {
Logger.getLogger(AbmMedico.class.getName()).log(Level.SEVERE, null, ex);
}
}