Tengo un error de sintaxis en el siguiente String
y no sé a que es debido. Nparte es de tipo int
.
String editSQL="UPDATE PARTESDETRABAJO SET DESCRIPCIONTAREA=?,"+"FECHAENTRADA=?,"+"FECHAENTREGA=?,"+"TIEMPOEMPLEADO=?"+"WHERE NPARTE="+sesion.getAttribute("ENparte");
Me sale el siguiente error y no consigo solucionarlo, he pasado sesion.getAttribute("ENparte")
a int
y me peta, pero así como está el error es este:
Error: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NPARTE=1' at line 1
...+"TIEMPOEMPLEADO=?"+"<espacioaquí>WHERE NPARTE="+...
System.out.println
deeditSQL
y lo podrás ver mejor..."TIEMPOEMPLEADO=?"+WHERENPARTE="+sesion.getAttribute("ENparte")
, es decir:"TIEMPOEMPLEADO=?"+"--->espacio aquí<---WHERE--->espacio aquí<---NPARTE="+sesion.getAttribute("ENparte")
. Por cierto, ¿por qué no usas también un marcador para elWHERE
como haces con los otros valores?, el código sería mucho más seguro así.