我试过了,re.getString(1)不行。取不出来

解决方案 »

  1.   

    String sql="select * from table where condition";
    ResultSet rs = statement.executeQuery(sql);
    rs.last();
    int i=rs.getRow();
      

  2.   

    String sql="select count(*) as int1 from table";
    ResultSet rs = statement.executeQuery(sql);
    int intCount = rs.getInt("int1");
    over!
    good luck!
      

  3.   

    给count(*) 起个别名不就完了!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      

  4.   

    rs.getString("name"),rs.getInt(数).......
      

  5.   

    如果还不行,就这样:
    while(rs.next())
    {
      count=rs.getRow();           // count
    }
      

  6.   

    于由rs对象在打开时的初始值是指向记录集的第一条记录的上方,所以只用rs.getInt(1);是不行的,必须先将记录集的指针指向第一条记录才行,所以必须做如下的步骤:
    1.    rs.next();
    2.
      

  7.   

    于由rs对象在打开时的初始值是指向记录集的第一条记录的上方,所以只用rs.getInt(1);是不行的,必须先将记录集的指针指向第一条记录才行,所以必须做如下的步骤:
    1.    rs.next();
    2.    rs.getInt(1);
    即可!