错误是:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在第 1 行的 ''3)' 附近使用正确的语法
代码是:
fecha = +jFecha.getCalendar().get(Calendar.YEAR) + "-" + (jFecha.getCalendar().get(Calendar.MONTH) + 1) + "-" + jFecha.getCalendar().get(Calendar .DAY_OF_MONTH); System.out.println(fecha); String parte = cmbParte.getSelectedItem().toString(); System.out.println(parte); 尝试 { Conexion.ins.execute("插入到 registros (id_registro, job, ip, id_parte, fecha, id_inspector, id_descripcion, piezasrech, piezasinsp, id_disposicion, id_area, id_responsable, id_estacion)" + "值(0,'" + txtOrder.getText() + "','" + txtIP.getText() + "','" + id_parte + "','" + fecha + "','" + id_inspector + "','" + id_descripcion + "','" + txtPR.getText() + "','" + txtPI.getText() + "','" + id_disposicion + "','" + id_area + "','" + id_responsable + "','" + id_estacion + ");"); JOptionPane.showMessageDialog(this, "Registro agregado con exito"); } 捕捉(SQLException e){ JOptionPane.showMessageDialog(this, "Error al intentar agregar el Registro"); System.out.println(e); } }