结果集中没有数据



我有以下代码:

string query = select COUNT(*) from  TRACKER where TYPE = ? and LAST_MODIFIED_TIME > LAST_RETREIVED_TIME;
prepStmt = connection.prepareStatement(query);
            prepStmt.setString(1, "xml");
            resultset = prepStmt.executeQuery();
            resultset.next();   
            int rowcount = resultset.getInt("COUNT(*)"); 

在数据库中,我有1行用于上面的查询,但在代码中,我得到的rowcount=0。有什么帮助吗?

尝试为count(*):提供别名

String query = "select COUNT(*) as count from  TRACKER where TYPE = ?"+
               " and LAST_MODIFIED_TIME > LAST_RETREIVED_TIME";
prepStmt = connection.prepareStatement(query);
prepStmt.setString(1, "xml");
resultset = prepStmt.executeQuery();
resultset.next();   
int rowcount = resultset.getInt("count"); 

相关内容

  • 没有找到相关文章

最新更新