double cre=0;
String stuID="20085092";
PreparedStatement pstmt=null;
DataBaseConnection dbc=new DataBaseConnection();
String sqltwo="update student SET All_credit=All_credit+? where Sno=?";
pstmt=dbc.getConnection().prepareStatement(sqltwo);
pstmt.setDouble(1,cre);
System.out.println(cre);
pstmt.setString(2,stuID);
System.out.println(3);
pstmt.executeUpdate(sqltwo);
System.out.println(4);
pstmt.close();
哪位大侠给看看我的与就出什么错了,看了快一天了,愁死了……错误是:
Exception in thread "main" 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 '? where Sno=?' at line 1
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2941)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1623)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1715)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3243)
at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1343)
at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1260)
at sdau.dxj.dao.impl.testIT.main(testIT.java:21)
不胜感激涕零%%%………………