Code snippet below gets the number of records contained by the ResultSet.


Java Code:
Statement s = con.createStatement();
ResultSet r = s.executeQuery("SELECT COUNT(*) AS rowcount FROM MyTable");
r.next();
int ResultCount = r.getInt("rowcount") ;
r.close() ;