derby - 我的删除按钮按钮不起作用无效光标状态 - 没有当前行
问题描述
删除按钮不起作用它说光标状态无效 - 没有当前行,源代码中没有错误是缺少代码为什么它不起作用?
private void DeleteActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
try {
int confirmed = JOptionPane.showConfirmDialog(null, "Are you
sure you want to delete the records?","Delete Button Message
Box",JOptionPane.YES_NO_OPTION);
if(confirmed == JOptionPane.YES_OPTION)
{
JOptionPane.showMessageDialog(StockPage.this, "Record Deleted");
rs.deleteRow();
stmt.close();
rs.close();
stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql = "SELECT * FROM STOCKNEW";
rs = stmt.executeQuery(sql);
rs.next();
int id_col = rs.getInt("ITEM");
String id = Integer.toString(id_col);
String description = rs.getString("DESCRIPTION");
String amt = rs.getString("AMOUNT");
update_table();
TextItem.setText(id);
TextDescription.setText(description);
TextAmount.setText(amt);
}else {
JOptionPane.showMessageDialog(StockPage.this, "Records was not Deleted");
}
}
catch(SQLException err) {
JOptionPane.showMessageDialog(StockPage.this, err.getMessage());
}
}
}
解决方案
推荐阅读
- javascript - 如何获取数组中每个项目的最后一个元素子元素
- python - 使用具有不同 IP 的 selenium webdriver python 打开 url(使用一些 IP 打开 url,更改 IP 并在 chrome 中再次打开)
- google-apps-script - 如何显示代码的单元格公式,而不是字符串?
- php - 如何通过与第一个收藏相关的记录找到收藏
- java - 将多条数据插入多行到Java中的SQL表中
- c# - 没有 virtual 和 override 的方法覆盖仅返回基类方法
- php - 电子邮件不发送给用户
- jquery - 一个 jQuery 选择器不适用于 safari。怎么了?
- php - 通过表单提交数据到数据库并查看结果+编辑数据
- v8 - 如何使用 WinDbg 使用源代码视图调试 V8?