Javaコードを使用してテーブルを切り捨てる方法
try{
con=db.setConnetion();
stm=con.createStatement();
stm.executeUpdate("TRUNCATE TABLE temptblDateWiseReport");
System.out.println("Truncated");
stm.close();
con.close();
}catch(SQLException ex){
System.out.println("General Info Error");
ex.printStackTrace();
}
それはエラーを与える
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6956)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7113)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3109)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:337)
at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:287)
at com.AshaIndustry.gui.DateWiseReport.jbtnPrintActionPerformed(DateWiseReport.java:245)