Oh i am sorry
"there is a problem in the pseudo code that you have displayed"
yes u r right
actually i do write rs2 = stmt.executeQuery(cmd); only
but it is not working
rs1 = stmt.executeQuery(cmd1)
while (rs1.next()){
;
;
rs2 = stmt.executeQuery(cmd2);
while(rs2.next()){
;
;
}
;
;
}
and the main thing is rs1 and rs2 is using same statement stmt
so here is that gotala i think
well i try with diff stmt and will tell u what happening
Thanks
Vaishali
"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