Hvorfor bliver resultset lukket ?
Jeg har flg. kode:Statement stmt = con.createStatement();
stmt.execute("USE " + dataBean.getDatabaseConnection().getDatabaseName());
query = "SELECT * FROM tbl_CottagePeriods WHERE Locked = 1 AND BookingOpenTo < getdate()";
rs = stmt.executeQuery(query);
Vector bookingTableRowsVector = new Vector();
Vector bookingTableColumnVector = new Vector();
while (rs.next()) {
dataBean.addPeriodInfo(rs.getString("Cottage_ID") + ": " + rs.getDate("DateFrom") + " - " + rs.getDate("DateTo"));
bookingTableColumnVector.addElement(this.languageBean.getBookingTableHeaderName());
bookingTableColumnVector.addElement(this.languageBean.getBookingTableHeaderEmail());
bookingTableColumnVector.addElement(this.languageBean.getBookingTableHeaderAccept());
query = "SELECT * FROM tbl_CottageBookings where Period_Id = " + rs.getString("Id");
rs1 = stmt.executeQuery(query);
while (rs1.next()) {
Vector bookingTableRowVector = new Vector();
bookingTableRowVector.addElement(rs1.getString("Name"));
bookingTableRowVector.addElement(rs1.getString("Email"));
bookingTableRowVector.addElement(this.languageBean.getBookingButtonApprove());
bookingTableRowsVector.addElement(bookingTableRowVector);
}
dataBean.addBookingTableViewModel(
getBookingTableViewModel(bookingTableColumnVector, bookingTableRowsVector));
bookingTableRowsVector = new Vector();
bookingTableColumnVector = new Vector();
}
Alle variabler m.m. er erklæret. Mit problem er at der er 2 records i første resultset, men jeg når kun igennem første gennemløb. Efterfølgende får jeg denne fejlmeddelelse:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Object has been closed.
Nogen fornuftig forklaring ??