0

hi guys, how can I retrieve the total record count from a database? I mean is there a method like "rst.recordCount"? or whatsoever? thanks...

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by choybutchoy
0

hi guys, how can I retrieve the total record count from a database? I mean is there a method like "rst.recordCount"? or whatsoever? thanks...

If you run this query at an SQL editor:

select count(*)
from your_table

It will get you the number of rows that table has.
In general the count() method "returns" the number of rows that the query would return.
So if you run the above query through java and do something like this:

ResultSet rs = null;
...
...
...

int count = rs.getInt(1);

The query return only 1 column (count(*)) so you need to call:
rs.getInt(1)

0

ow there you go, i never thought that there is a statement like this, sori but im not too familiar in all the SQL Statement just the basic i guess...by the way thanks...

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.