Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL QUERY IN JSP PAGE

843838Nov 26 2006 — edited Jul 30 2007
Dear Friends,

There is a table named as EXPENSES having fields as sl_no, name.

I want to find the MAXIMUM value of the sl_no.

For that i am using the query as " SELECT MAX(sl_no) FROM EXPENSES "

In JSP file my code is ......................

ResultSet rs= stmt.executeQuery(" SELECT MAX(sl_no) FROM EXPENSES ");
if(rs.next()) {
out.println(rs.getInt("sl_no"));
}

this out.println line throws a exception as "column not found"

My aim is just to find the maximu value of a field from a table by using the jsp as a front end.

So please reply me how can I slove that problem.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 27 2007
Added on Nov 26 2006
5 comments
129 views