vendredi 3 novembre 2017

sqlsyntax error but code seems fine

the error i get is : 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 'Desc) values(1,'Sem 2','1',1,'1234','2017-11-03','2',3,'vnfhmj.k;/kkc')' at line 1

if i remove desc...the error is gone...is there a limit to number of items which can be entered

Code:

String query="insert into exam(sub_id,exam_sem,co,tch_id,ex_pwd,ex_date,ex_duration,noofq,Desc) values(?,?,?,?,?,?,?,?,?)"; PreparedStatement pstmt=DatabaseConnector.getPreparedStatement(query); //pstmt.setInt(1,ed.getEx_id()); pstmt.setInt(1,ed.getSub_id()); pstmt.setString(2,ed.getEx_sem()); pstmt.setString(3,ed.getEx_co()); pstmt.setInt(4,ed.getT_id()); pstmt.setString(5,ed.getEx_pwd()); pstmt.setString(6,ed.getEx_date()); pstmt.setString(7,ed.getEx_duration()); pstmt.setInt(8,ed.getNoofq()); pstmt.setString(9,ed.getDesc());




Aucun commentaire:

Enregistrer un commentaire