请教:为什么select Max(id) as id from TLoss where eid =?";后得到的rs.getInt("id");就会出错!
请教:为什么select Max(id) as id from TLoss where eid =?";
后得到的rs.getInt("id");就会出错!
public int getLossid(int eid) throws Exception {
String sql = "select Max(id) as id from TLoss where eid =?";
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
conn = DBManager.getConnection();
ps = conn.prepareStatement(sql);
ps.setInt(1, eid);
rs = ps.executeQuery();
int abc = rs.getInt("id");////////这一行会报错!!!为什么???
return abc;
}
请指教!!! 谢谢!!!