Hi, I create a resultset which has only 1 result(int)
try
{
//Get connection
String sql="SELECT MAX(numberField) from table";
stmt=con.createStatement();
rs=stmt.executeQuery(sql);
while(rs.next())
{
int highNum=rs.getInt(1);
}
rs.close;
rs=null;
stmt.close();
stmt=null;
}
finally
{
if(con!=null)
{con.close();
}
}
this works fine, the problem is I need this value(highNum) throughout the jsp, how?, as now it is only available within the while(rs.next)block.
THANKS!!
easy...just declare "int highNum;" anywhere outside any blocks/loops that you want to use it in then just use "highNum = rs.getInt(1)" or whatever in your code.