INSERT INTO 语句的语法错误
public void cun(){SimpleDateFormat sd=new SimpleDateFormat(" HH:mm:ss");
Connection con=ss.getConnection();
String insert="insert event (cardid,money,date) values('"+cardid+"',"+
Integer.parseInt(jTextField1.getText().trim())+",'"+sd.format(new Date())+"')";
String add="update card set leavemoney =leavemoney+"+ Integer.parseInt(jTextField1.getText().trim())
+"where cardid='"+cardid+"'";
PreparedStatement pstmt = null;
PreparedStatement pstm = null;
try{
pstmt=con.prepareStatement(insert);
pstm=con.prepareStatement(add);
pstmt.executeUpdate();
pstm.executeUpdate();
}catch(SQLException e){
e.printStackTrace();
}
}
我写的一个方法 运行后报错
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] INSERT INTO 语句的语法错误。
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114)
at sun.jdbc.odbc.JdbcOdbc.SQLPrepare(JdbcOdbc.java:4830)
at sun.jdbc.odbc.JdbcOdbcConnection.prepareStatement(JdbcOdbcConnection.java:475)
at sun.jdbc.odbc.JdbcOdbcConnection.prepareStatement(JdbcOdbcConnection.java:443)
不知道怎么回事?