我正在java.sql.SQLException: General error
尝试从Access数据库删除数据,但是会引发该错误。尝试{
conn = DBConnection.DBConnector();
pst = conn.prepareStatement("DELETE FROM Table1 where (name, level, study, 1pn, 2pn, 1pk, 2pk, summ, teori, p-d, ind, gat, pav) values (?,?,?,?,?,?,?,?,?,?,?,?,?)");
pst.setString(1, (String) dsr[0]);
pst.setString(2, (String) dsr[1]);
pst.setString(3, (String) dsr[2]);
pst.setDouble(4, (double) dsr[3]);
pst.setDouble(5, (double) dsr[4]);
pst.setDouble(6, (double) dsr[5]);
pst.setDouble(7, (double) dsr[6]);
pst.setDouble(8, (double) dsr[7]);
pst.setDouble(9, (double) dsr[8]);
pst.setDouble(10, (double) dsr[9]);
pst.setDouble(11, (double) dsr[10]);
pst.setDouble(12, (double) dsr[11]);
pst.setDouble(13, (double) dsr[12]);
pst.executeUpdate();
pst.close();
JOptionPane.showMessageDialog(null, "Data delited!");
}catch(Exception e){
throw new RuntimeException(e);
}
来自数据库的数据完美地插入到JTable中,我让JOptionPane.showMessageDialogs检查数组是否不为null,但是该数组填充了白色值。
我尝试删除一个值,但仍然收到相同的错误...
Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: java.sql.SQLException: General error
Caused by: java.sql.SQLException: General error
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLExecute(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeQuery(Unknown Source)
at Main$ButtonEditor.getCellEditorValue(Main.java:442)
使用executeUpdate
数据库的写操作
pst.executeUpdate();
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句