This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

maximum value of a column

 
lakshmanan anand
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Chiranjeevi Kanthraj
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

res.next();
you have to move the resultset to some specific location before doing get operation
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic