首页 > 数据库技术 > 详细

com.mysql.jdbc.exceptions.MySQLSyntaxErrorException错误

时间:2015-05-29 11:22:27      阅读:245      评论:0      收藏:0      [点我收藏+]
com.mysql.jdbc.exceptions.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 ‘receiverTel=‘123131‘ payment=0,time =‘2015-04-10 10:14‘, tradeTime=‘‘,sndgoodsTi‘ at line 1 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723) at com.mysql.jdbc.Connection.execSQL(Connection.java:3283) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1332) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1604) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1519)

 这是因为receiverTel与payment少了一个逗号,

String sql = "update em_order set orderId=?,userId=?,receiverName=?,receiverAddress=?,postCode=? receiverTel=?,payment=?,time =?, tradeTime=?,
sndgoodsTime=? state=? where id =? "; JDBCUtils.upDate(sql,o.getOrderId(),o.getUserId(),o.getReceiverName(),o.getReceiverAddress(),o.getPostCode(),o.getReceiverTel(),
o.getPayment(),o.getTime(),o.getTradeTime(),o.getSndgoodsTime(),o.getState(),o.getId());

 

java.sql.SQLException: Parameter index out of range (11 > number of paramete,which is 0);

 这个错误是因为少写了一个?,在查询数据库代码中。

com.mysql.jdbc.exceptions.MySQLSyntaxErrorException错误

原文:http://www.cnblogs.com/ouysq/p/4537776.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!