怎么判断从数据库中查到的结果集为空??

解决方案 »

  1.   

    判断(ResultSet) resultset.next()是否为true,
    或者你直接执行sql语句为"select count(*)..."判断是否为0就ok了
      

  2.   

    rs.getRow()getRow
    int getRow()
               throws SQLExceptionRetrieves the current row number. The first row is number 1, the second number 2, and so on. Returns:
    the current row number; 0 if there is no current row 
    Throws: 
    SQLException - if a database access error occurs
    Since: 
    1.2 
      

  3.   

    ResultSet res=.....;
    if(res.next()){
    // todo:一些操作;
    else
    throw new Exception("没有数据");