Below is my code in which c1.menu() gives my values from database in Rmenu.
but when compilation proceeds downwards, there is another line ResultSet Rmenu1 = c1.menu1();
which gives me another result set Rmenu1 which have values from database through menu1(); function.
But after execution of its while(Rmenu1.next()) when the cursor comes back to while(Rmenu.next())
it gives error as " Result set is closed".
Is it so that a there can be only one result set at a time or is it a threading issue.
Please help.
try
{
ResultSet Rmenu = c1.menu();
String Strmenu=null;
String UpperStr=null;
String compareStr=null;
int charind;
int n=0;
while(Rmenu.next())
{
Strmenu = Rmenu.getString("HeaderScreenName");
charind = Strmenu.indexOf("-");
UpperStr = Strmenu.substring(0,charind);
if(Strmenu.contains(UpperStr))
{
if(!UpperStr.equals(compareStr))
{
compareStr=UpperStr;
%>
<li>
<a href="#"><% out.println(UpperStr); %></a>
<ul>
<% }
int i=0;
ResultSet Rmenu1 = c1.menu1();
while(Rmenu1.next())
{
if(Strmenu.contains(UpperStr))
{
if(i==0)
{
%>
<li><a href="#"><% out.println(Strmenu.replace(UpperStr+"-","")); %></a></li>
<% i++; }
}
}
} %>
</ul>
</li>
<%}
}
catch(Exception e)
{
out.println(e);
e.printStackTrace();
}