日期:2014-05-17 浏览次数:20659 次
public List<Record> querryByID(int id) throws Exception { list = new ArrayList<Record>(); try { sql = "SELECT carno,owner,dname,reason,date FROM record,depart WHERE depart.did=record.depart AND rid=?"; this.ps = this.connection.prepareStatement(sql); this.ps.setInt(1, id); ResultSet rs=this.ps.executeQuery(); while (rs.next()) { System.out.println("*********"+rs.next()); record = new Record(); record.setCno(rs.getString(1)); record.setOwner(rs.getString(2)); record.setDepartName(rs.getString(3)); record.setReason(rs.getString(4)); record.setDate(rs.getString(5)); list.add(record); } } catch (Exception e) { throw e; } finally { if (this.ps != null) { try { this.ps.close(); } catch (Exception e) { throw e; } } } return list; } }