Link to home
Start Free TrialLog in
Avatar of aseelad
aseelad

asked on

nested result set

i  got this problem i do not way :$
WARNING: StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception
java.sql.SQLException: Operation not allowed after ResultSet closed

i have tryed every thing :(

</tr>      
         <%
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection = DriverManager.getConnection(connectionURL, "root", "1212");
statement = connection.createStatement();
int num=0;
rs = statement.executeQuery("SELECT * FROM webpage");
while (rs.next()) {
%>
 <tr class="odd" >
<%
out.print(rs.getString("id"));
num=Integer.parseInt(rs.getString("id"));
rs2 = statement.executeQuery("SELECT * FROM textspace where WPID="+num);
while (rs2.next())
    {
%>
  <td class="zname"><b><%=rs2.getString("cpc")%></b></td>
<td class="size"><%=rs2.getString("MoneyGained")%><br/>Inline</td>
<td class="approve">Yes</td>
 <td class="clicks"><%=rs2.getString("NumberOfClicks")%></td>
 <td><input type="button" onclick="<%response.sendRedirect("deletespace.jsp?id="+rs2.getString("Id"));%>"></input>
 </td>

   <%}
   rs2=statement.executeQuery("SELECT * FROM bannerspace where WPID="+num);
while(rs2.next())
    {
%>
  <td class="zname"><b><%=rs2.getString("cpc")%></b></td>
<td class="size"><%=rs2.getString("MoneyGained")%><br/>Inline</td>
<td class="approve">Yes</td>
 <td class="clicks"><%=rs2.getString("NumberOfClicks")%></td>
 <td><input type="button" onclick="<%response.sendRedirect("deletespace.jsp?id="+rs2.getString("Id"));%>"></input>
 </td>
 <%
 }
%>
</tr>
<%
}

%>

 
<br/>
<tr><td colspan="11" class="new_zone bottom"><a href="websiteinfo.jsp" class="add">Set up a new ad space</a></td>
</tr>
<br/>
</tbody>
</table><!-- www002 -->

 
</div>            
</form>

  <%

   connection.close();
%>
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aseelad
aseelad

ASKER

thanks that worked for me
but if i want to add a check box to each row for delete ...how can i do that ?
add a checkbox with the row id as its value
ask a new question if you need help getting it to work