File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes maximum value of a column Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "maximum value of a column" Watch "maximum value of a column" New topic
Author

maximum value of a column

lakshmanan anand
Greenhorn

Joined: Jan 13, 2009
Posts: 22
hi,

I am trying to add rows to a table (name : csv) whose schema is

ID Name Place
-- ------ --------

ResultSet res = stmt.executeQuery("select max(id) as id from csv");
int i = res.getInt("id");
i++;

i want to get the maximum value of ID . when i typed the above code, i get SQLException. what shall i do.


http://luckydev07.blogspot.com
Chiranjeevi Kanthraj
Ranch Hand

Joined: Feb 18, 2008
Posts: 290


res.next();
you have to move the resultset to some specific location before doing get operation


-Chiru
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: maximum value of a column