Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

ResultSet empty?

BeekmanBeekman Posts: 8Member
How can I check if a normal ResultSet is empty?

Every operation I try on an empty ResultSet always gives the error; Illegal operation on empty result set...

Comments

  • sfkwansfkwan Posts: 25Member
    : How can I check if a normal ResultSet is empty?
    :
    : Every operation I try on an empty ResultSet always gives the error; Illegal operation on empty result set...
    :
    :
    can u pls show ur code....
  • javakiddojavakiddo Posts: 31Member
    : How can I check if a normal ResultSet is empty?
    :
    : Every operation I try on an empty ResultSet always gives the error; Illegal operation on empty result set...
    :
    :

    hi, try
    [code]
    try{
    String url ="jdbc.odbc:Mydb";
    String query = "SELECT * FROM MyTable";
    new sun.jdbc.odbc.JdbcOdbcDriver();
    Connection connection = DriverManager.getConnection(url);
    Statement statement = connection.createStatement();
    ResultSet rs = statement.executeQuery( query );
    if(rs.next())
    {
    System.err.println("MyResultSet Contains Data");
    }
    else
    {
    System.err.println("MyResultSet is Empty");
    }
    }catch(SQLException sqle){sqlex.printStackTrace();}
    [/code]
    Ghassan A.
    checkout==> http://groups.yahoo.com/group/thesaudiFriends

Sign In or Register to comment.