Java - ¿como solucionar el error ? Exception in thread “AWT-EventQueue-0” java.lang.ArrayIndexOutOfBoundsEx

 
Vista:

¿como solucionar el error ? Exception in thread “AWT-EventQueue-0” java.lang.ArrayIndexOutOfBoundsEx

Publicado por Carlos (4 intervenciones) el 09/07/2020 06:52:45
Hola tengo este error dentro del boton actualizar, este lo utilice para actualizar datos ya existentes en una base de datos seleccionandolo desde el jtable pero al momento de precionar un dato de un usuario para actualiarlo me da un error( Exception in thread “AWT-EventQueue-0” java.lang.ArrayIndexOutOfBoundsEx), espero su ayuda...

codigo:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
String ID = Tabla_Registro.getValueAt(Tabla_Registro.getSelectedRow(), 0).toString();
String TD = Tabla_Registro.getValueAt(Tabla_Registro.getSelectedRow(), 1).toString();
String doc = Tabla_Registro.getValueAt(Tabla_Registro.getSelectedRow(), 2).toString();
String nom = Tabla_Registro.getValueAt(Tabla_Registro.getSelectedRow(), 3).toString();
String ape = Tabla_Registro.getValueAt(Tabla_Registro.getSelectedRow(), 4).toString();
String tel = Tabla_Registro.getValueAt(Tabla_Registro.getSelectedRow(), 5).toString();
String dir = Tabla_Registro.getValueAt(Tabla_Registro.getSelectedRow(), 6).toString();
String fech = Tabla_Registro.getValueAt(Tabla_Registro.getSelectedRow(), 7).toString();
String hora = Tabla_Registro.getValueAt(Tabla_Registro.getSelectedRow(), 8).toString();
String mot = Tabla_Registro.getValueAt(Tabla_Registro.getSelectedRow(), 9).toString();
frmActualizar Act = new frmActualizar(null, true);
Act.AtxtID.setText(ID);
Act.AcbTD.setSelectedItem(TD);
Act.AtxtDocumento.setText(doc);
Act.AtxtNombre.setText(nom);
Act.AtxtApellido.setText(ape);
Act.AtxtTelefono.setText(tel);
Act.AtxtDireccion.setText(dir);
Act.AtxtFechaI.setText(fech);
Act.AtxtHoraI.setText(hora);
Act.AtxtMotivo.setText(mot);
Act.setVisible(true);
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
-1
Responder
Imágen de perfil de Kabuto
Val: 3.428
Oro
Ha mantenido su posición en Java (en relación al último mes)
Gráfica de Java

¿como solucionar el error ? Exception in thread “AWT-EventQueue-0” java.lang.ArrayIndexOutOfBoundsEx

Publicado por Kabuto (1381 intervenciones) el 10/07/2020 02:01:43
Mejor si poner el error completo.
Y también como está declarada la tabla.
Supongo que 10 columnas es correcto.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

¿como solucionar el error ? Exception in thread “AWT-EventQueue-0” java.lang.ArrayIndexOutOfBoundsEx

Publicado por Carlos (4 intervenciones) el 10/07/2020 07:09:54
Hola gracias por tu ayuda ya solucione el error, me puedes ayudar con este, estoy tratando de actualizar los datos de una base de datos y para eso hice este codigo dentro del boton actualizar... y el error q sale este(jul 10, 2020 12:08:49 AM Formularios.frmActualizar Btn_ActualizarActionPerformed
GRAVE: null
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near .......line 1)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
try {
    ConexionBD Con = new ConexionBD();
    Con.ConectarBD();
    String id = AtxtID.getText();
    String td = AcbTD.getSelectedItem().toString();
    String doc = AtxtDocumento.getText();
    String nom = AtxtNombre.getText();
    String ape = AtxtApellido.getText();
    String tel = AtxtTelefono.getText();
    String dir = AtxtDireccion.getText();
    String fi = AtxtFechaI.getText();
    String hi = AtxtHoraI.getText();
    String mot = AtxtMotivo.getText();
    String SQL = " UPDATE personas SET"
    + "Td = '"+td+"', Documento =  '"+doc+"', Nombre = '"+nom+"',"
    + "Apellido = '"+ape+"', Telefono = '"+tel+"',"
    + "Direccion = '"+dir+"', Fecha_ing = '"+fi+"', Hora_ing = '"+hi+"',"
    + "Motivo = '"+mot+"'"
    + "WHERE Id = '"+id+"'";
    Con.sentencia.execute(SQL);
    JOptionPane.showMessageDialog(null, "¡Registro Actualizado con éxito!");
    Con.DesconectarBD();
} catch (SQLException ex) {
    Logger.getLogger(frmActualizar.class.getName()).log(Level.SEVERE, null, ex);
}
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar