I need to use two resultset iteration in a single whileloop.
Eg :
while(rs1.next() && rs2.next())
{
if(rs1.next())
{ do something }
else if(rs2.next())
{ do something }
else { do something }
}
Is this the right way?
In your example the condition that will start while loop is rs1.next() && rs2.next()
this means if both of them true then start the loop but in loop you have these
if(rs1.next())
{ do something }
else if(rs2.next())
{ do something }
else { do something }
if you look carefully you can see first condition will always be true(if loop starts of course) and other if statments(or else-if's, else's) will not work. By the way i don't understand what you are looking for clearly, can you explain more?