码迷,mamicode.com
首页 > 数据库 > 详细

com.mysql.jdbc.exceptions.MySQLSyntaxErrorException错误

时间:2015-05-29 11:25:32      阅读:125      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!