代码如下:
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");