0

在我的代码中的 ResultSet 关闭错误后,我得到 Operation not allowed 。我的代码如下。我正在使用一种方法来计算薪水,然后我在对象中设置了这个薪水。

       try {
            while (rs.next()){
                int sala = 0;
                int sa = Integer.parseInt(rs.getString(4));
                int lea = Integer.parseInt(rs.getString(5));
                String name = rs.getString(2);
                sala = getsalary(name, fromdate, todate, lea, sa);

                s.setEmpid(Integer.parseInt(rs.getString(1)));
                s.setEmpname(rs.getString(2));
                s.setEmpcat(rs.getString(3));
                s.setSalary(sala);
                s.setLeaves(Integer.parseInt(rs.getString(5)));

                sal.add(s);
                s = new salary();
                rowCount++;
            }
        } catch (Exception e) {
            System.out.println(e);
        }
4

1 回答 1

0

例外是因为我相信您正在从其他方法调用的方法的参数中接收 ResultSet。你已经关闭了那里的连接,所以在这里你得到了这个异常。请向我们展示带有参数的完整方法

于 2012-11-23T13:42:00.687 回答