i am facing a problem in running multiple queries in jsp page, as it is unable to store the values in the 2nd result set i use in my page.
tha code is written below:
String strQuery = "select * from services ";
ResultSet rs =null;
ResultSet rs1 = null;
rs = st.executeQuery(strQuery);
while(rs.next())
{
String[] serviceArray;
serviceArray = request.getParameterValues("services");
for (int i = 0; i < serviceArray.length; i++)
{
//Retreive service Name to put in Prof_strig.
String sql = "select * from services";
out.println(sql);
rs1= st1.executeQuery(sql);
while(rs1.next())
{
<tr>
<td><%=rs1.getString(1) %></td>
<td> <%=rs1.getString(2) %></td>
</tr>
<%
}
}
}
}
catch(SQLException e)
{
e.getMessage();
}
%>
In this code m able to get the values in
rs = st.executeQuery(strQuery);
but when i use the second result set
rs1= st1.executeQuery(sql);
it's unable to retreive values.
It return '0' on using rs1.getrow() function,i.e. no value retrieved.
Kindly help me to sort this out.
I can't guess if there's problem using multiple resultsets or its something else.
Thanks.