SELECT count (*) FROM table   在java中用什么接受到这个值??? 具体点.

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【hanhan7750】截止到2008-07-09 13:51:26的历史汇总数据(不包括此帖):
    发帖的总数量:0                        发帖的总分数:0                        每贴平均分数:0                        
    回帖的总数量:9                        得分贴总数量:0                        回帖的得分率:0%                       
    结贴的总数量:0                        结贴的总分数:0                        
    无满意结贴数:0                        无满意结贴分:0                        
    未结的帖子数:0                        未结的总分数:0                        
    结贴的百分比:---------------------结分的百分比:---------------------
    无满意结贴率:---------------------无满意结分率:---------------------
    如何结贴请参考这里:http://topic.csdn.net/u/20080501/09/ef7ba1b3-6466-49f6-9d92-36fe6d471dd1.html
      

  2.   

    SELECT count (*) FROM table 
    改成 SELECT count (*) cou FROM table rs.getInt("cou");
      

  3.   

    rs.getString()几乎可以接收所有类型的数据
      

  4.   


    int count = rs.getInt(0);
      

  5.   

    SELECT count (*) as cou FROM table
     rs.getString("cou");
      

  6.   

    pstm = con.preparedStatement("select count(*) as num from table");
    rs = pstm.executeQuery();
    int total = rs.getInt(num);
      

  7.   

    ConnectionBean cb=new ConnectionBean();
            Connection con=cb.getConnection();
            String sql="select count(*) from "+tableName;
            PreparedStatement preparedStatement=null;
            ResultSet rs=null;
            try {
                preparedStatement = con.prepareStatement(sql);
    //            preparedStatement.setString(1,tableName);
                rs=preparedStatement.executeQuery();
                if(rs.next()){
                    int page = rs.getInt(1);
                    this.setRowCount(rs.getInt(1));
                }
            } catch (SQLException ex) {
                ex.printStackTrace();
            }finally{
                cb.closeResultSet(rs);
                cb.closePreparedStatement(preparedStatement);
                cb.closeConnection(con);
            }
            this.setRowsPerPage(rowsPrerPage);
            this.setMaxPage(this.getRowCount()/this.getRowsPerPage());