Function that Returns No of Rows in ResultSet

public int getRows(ResultSet res)
{
  int totalRows = 0;

  try
  {
     res.last();
     totalRows = res.getRow();
     res.beforeFirst();
  }
  catch(Exception ex)  
  {
     return 0;
  }
  
  return totalRows ;    
}

Leave a reply