| Author |
How to get total records
|
Yogesh Dhond
Greenhorn
Joined: Jul 19, 2006
Posts: 17
|
|
Hi!! I have a query as below in mysql select count(*) as MAXCOUNT from table1; how do i use this MAXCOUNT variable in my java program?
|
 |
Masoud Kalali
Author
Ranch Hand
Joined: Jul 08, 2004
Posts: 531
|
|
what you mean in your java application ? you can create a connection , create an statement, execute the statement , get the result set , and first column in first row is your record count. is it what you are looking for ?
|
Masoud Kalali
Software Engineer - My Weblog - GlassFish Security
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26192
|
|
Yogesh, You have two choices: 1) rs.next(); int count = rs.getInt(1); 2) rs.next(); int count = rs.getInt("maxCount");
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Yogesh Dhond
Greenhorn
Joined: Jul 19, 2006
Posts: 17
|
|
Thank you very much!! I got the required answer.
|
 |
 |
|
|
subject: How to get total records
|
|
|