evne then do not try to run the statement within the while loop. put it outside the loop of rs1 Regards
Ramesh Kesavanarayanan Electronic Data Systems India pvt Ltd * 91-44-254 9650 ext :2469 * [EMAIL PROTECTED] -----Original Message----- From: Vaishali S. Pandya [mailto:[EMAIL PROTECTED]] Sent: Monday, 24 June 2002 2:37 PM To: [EMAIL PROTECTED] Subject: Re: resultset in resultset not working Yes the prob was there only u have u use 2 diff stmts when u r using 1 rs in 2nd now it's working well but what is the reason? Regards Vaishali Reliance Ind Ltd. A'bad "It, Cockpit (CAP, To: [EMAIL PROTECTED] Contractor)" cc: <Cockpit.It@GEIND Subject: Re: resultset in resultset not working .GE.COM> Sent by: A mailing list about Java Server Pages specification and reference <JSP-INTEREST@JAV A.SUN.COM> 06/24/02 02:20 PM Please respond to A mailing list about Java Server Pages specification and reference Dear Vishali, I don't know whether there is a problem in the pseudo code that you have displayed was wrong or you had made the same mistake in your code also. First of all you can not execute/run a query/cmd in a result set but your code shows rs2.executeQuery(cmd). If you really want to execute result set inside another result set you have to create two seperate statements using which you can do. This is not valid in JDBC1.0. In JDBC2.0 you can achieve this as follows... Statement stmt1= con.createStatement(); Statement stmt2= con.createStatement(); ResultSet rs1= stmt1.executeQuery(YourQueryHere); ResultSet rs2 = null; while(rs.next()){ rs2= stmt2.executeQuery(YourQueryHere); While (rs2.next()){ //do your work here..... } } Here instead of stmt2 you can replace this with PreparedStatement as this is the exact situation where you have to use prepared statement. When you use a same query more than one times PreparedStatement is there to optimize it. All the best Yogaraj -----Original Message----- From: Vaishali S. Pandya [mailto:[EMAIL PROTECTED]] Sent: Monday, June 24, 2002 1:36 PM To: [EMAIL PROTECTED] Subject: resultset in resultset not working hi friends here 2 resultsets rs1 and rs2 while (rs1.next()){ ; ; rs2.executeQuery(cmd); while(rs2.next()){ ; ; } ; ; } there are some records in rs1 but after executing 1st record it comes out from while. rs2 is working fine. where I mistep? can anyone make me correct? Thanks Vaishali Reliance Ind Ltd A'bad =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com "THIS E-MAIL MESSAGE ALONG WITH ANY ATTACHMENTS IS INTENDED ONLY FOR THE ADDRESSEE and may contain confidential and privileged information. If the reader of this message is not the intended recipient, you are notified that any dissemination, distribution or copy of this communication is strictly Prohibited. If you have received this message by error, please notify us immediately, return the original mail to the sender and delete the message from your system." =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com