[英]java.sql.SQLException:General error
I'm getting java.sql.SQLException: General error
I'm trying to delete data from Access DataBase but it throws that error. 我正在获取
java.sql.SQLException: General error
我正在尝试从Access数据库删除数据,但会引发该错误。 try{ 尝试{
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);
}
Data from DataBase inserts perfectly in JTable, i had JOptionPane.showMessageDialogs to check the array if it isn't null, but the array is filled whit values. 来自数据库的数据完美地插入到JTable中,我让JOptionPane.showMessageDialogs检查数组是否不为null,但是数组填充了白色值。
I tried to delete by one value but it still gets the same error... 我尝试删除一个值,但仍然收到相同的错误...
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();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.