问题描述
删除按钮不起作用,表示光标状态无效-当前行不存在,源代码中没有错误,缺少缺少代码的原因吗?
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());
}
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)