Get Row Count

Submitted by:David Villa

Date added:14 February, 2012

Category:MySQL

Use this to size an array for your values

Tags: row count

Code Snippet:

/*
* get row count
*/
protected static int getResultSetSize(ResultSet resultSet) {
int size = -1;

try {
resultSet.last();
size = resultSet.getRow();
resultSet.beforeFirst();
} catch(SQLException e) {
return size;
}

return size;
}
 
 

Comments