[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

nested result set

Posted on 2010-03-26
3
Medium Priority
?
366 Views
Last Modified: 2012-05-09
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();
%>
0
Comment
Question by:aseelad
  • 2
3 Comments
 
LVL 92

Accepted Solution

by:
objects earned 2000 total points
ID: 28676007
create a 2nd statement and use it to get the 2nd result set
0
 

Author Comment

by:aseelad
ID: 28701234
thanks that worked for me
but if i want to add a check box to each row for delete ...how can i do that ?
0
 
LVL 92

Expert Comment

by:objects
ID: 28721107
add a checkbox with the row id as its value
ask a new question if you need help getting it to work
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question