代码如下:

1 ResultSet rs = stmt.executeQuery("SELECT sum() from....");  
2 int keyValue = -1;   
3 if (rs.next()) {  
4     keyValue = rs.getInt(1);  
5 }  

 rs.getInt()里面的参数也可以是字段名,

比如:

rs.getInt("pNum");

posted on 2016-11-13 23:03  wEndu  阅读(1898)  评论(0编辑  收藏  举报