sshgwyx
发贴: 3
|
于 2004-09-13 10:56
public Collection getMessage()throws Exception { Collection ret=new ArrayList(); try { Statement stm=con.createStatement(); ResultSet result=stm.executeQuery("select count from message"); int message_count=0; if(result.next()) { message_count=result.getInt(1); result.close(); } if(message_count>0) { result=stm.executeQuery("select * from message order by time desc"); while(result.next()) { String title=result.getString("title"); MessageVO message=new MessageVO(); message.setName(name); ret.add(message);//??如何理解 } result.close(); stm.close(); } con.close(); } catch(Exception e) { e.printStackTrace(); throw e; } return ret;//??如何理解 }
|