j**a代码求解释

时间:2015.01.19 发布人:EyoungShieh

j**a代码求解释

已解决问题

谷歌EyoungShieh用户在2015.01.19提交了关于“都市狂枭j**a代码求解释”的提问,欢迎大家涌跃发表自己的观点。目前共有1个回答,最后更新于2024-09-04T09:55:55。

publicList<Board>findAll(){
try{
Stringsql="select*fromboardorderbyiddesc";
Connectionconn=getConnection();
PreparedStatementpstmt=conn.prepareStatement(sql);
ResultSetrs=pstmt.executeQuery();
List<Board>boardList=newArrayList<Board>();
while(***.next()){
Boardboard=createBoard(rs);
boardList.add(board);
}
returnboardList;
}catch(Exceptione){
e.printStackTrace();
thrownewRuntimeException(e);
}finally{
try{
this.close();
}catch(SQLExceptione){
e.printStackTrace();
}
}
}

第5、6、8行是什么意思

希望大家能够帮助她。

详细问题描述及疑问:

publicList<Board>findAll(){
try{
Stringsql="select*fromboardorderbyiddesc";
Connectionconn=getConnection();
PreparedStatementpstmt=conn.prepareStatement(sql);
ResultSetrs=pstmt.executeQuery();
List<Board>boardList=newArrayList<Board>();
while(***.next()){
Boardboard=createBoard(rs);
boardList.add(board);
}
returnboardList;
}catch(Exceptione){
e.printStackTrace();
thrownewRuntimeException(e);
}finally{
try{
this.close();
}catch(SQLExceptione){
e.printStackTrace();
}
}
}

第5、6、8行是什么意思

期待您的答案,你就是当代的活雷锋,太感谢了 !
希望以下的回答,能够帮助你。

第1个回答

用户名:刘姗姗的好老公  

//5行他是来自将你的sql写进去

P好片reparedSt问答atementpstmt=conn.prepareStatement(sql);

//6行访问**库进行**库的sql查询语句也就是:select*fromboardorderbyiddesc

ResultSetrs听需菜持汉金=pstmt.executeQuery();

//8行那就简单了那就是把你从**库中查询的**输出出来放到list集合里面

while(***.next()){
Boardboard=createBoard(rs);
boar握尼挥另dList.add(board);
}