{{theTime}}

Search This Blog

Total Pageviews

How to find the number of rows in the resultset (CountResult)

public static int getRowCount(ResultSet set) throws SQLException
{
sqlString = "select * from country";
// Create a scrollable ResultSet.
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
rs = stmt.executeQuery(sqlString);
// Point to the last row in resultset.
rs.last();
// Get the row position which is also the number of rows in the ResultSet.
int rowcount = rs.getRow();
// Reposition at the beginning of the ResultSet to take up rs.next() call.
rs.beforeFirst();
return rowcount ;
}

No comments:

Cucumber Eclipse sample program

Cucumber Eclipse SetupCreate Eclipse Maven Project Open pom.xml Goto Dependencies Add GroupId: info.cukes, Artifact Id: cucumber-java, Versi...