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...

Recommended Answers

All 2 Replies

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)

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...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.