ResultSet empty? - Programmers Heaven

Howdy, Stranger!

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

Categories

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.