没太看懂你的意思。。假如是mysql中,你要找记录select * from table where id = '1'你 result.next() 如果没有的话,不就是没找到数据??

解决方案 »

  1.   

    可以这样,就是稍微麻烦了一点点
    String strsql="select count(*) from yourtablename";
    ResultSet rs=conn.executeQuery(strsql);
    rs.next();
    int count=rs.getInt(1);
    if(int==0){
    //没有找到数据
    }
      

  2.   

    写错了,最后应该是
    if(count==0){
    //没有找到数据}
      

  3.   

    楼主请仔细检查一下。用if(rs.next())或while(rs.next())是不会抛出“用尽的这resultset”这样的异常的。ResultSet.next()是检查rs 还有没有下一行数据,没有的话就返回flase,有的话就把cursor指向下一行数据,并返回true。
    只有在没有用rs.next()判断就直接调用rs.getXXX()这样的函数时才可能会抛出“用尽的这resultset”异常。
      

  4.   

    bool haveData=false;
    while(result.next()){
    haveData=true;
    }
      

  5.   

    同意Tasia(这里是CSDN吗?) 的看法
      

  6.   

    晕,给我30分,好强,搂主不要害我啊,一会儿斑竹还以为在倒分,应该是给Tasia