java使用NetBeans删除Oracle 11g数据库中的行
我试图删除数据库中的一行,该行与JTextField
中的某个内容匹配。但是出现了一个异常,下面的代码没有告诉我原因。我能做什么
try{Class.forName("oracle.jdbc.OracleDriver");
PreparedStatement pstmnt;
try (
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","hr","123")) {
pstmnt = conn.prepareStatement("delete from TEMP where matricRoll=?");
pstmnt.setString(1, matricRoll.getText());
pstmnt.executeUpdate();
conn.close();
pstmnt.close();
GI.setVisible(true);
ED.setVisible(false);
addingToFrame();
settingBounds();
} catch (SQLException ex) {JOptionPane.showMessageDialog(null,"error");}
} catch (ClassNotFoundException ex) {
}
# 1 楼答案
试试这个:
# 2 楼答案
谢谢大家的关注。。我发现了错误。。我正在从一个无效的列中删除。。。 以下是解决方案