Click to See Complete Forum and Search --> : loop query


leeny
02-13-2005, 10:31 PM
please assist me.

I've got no idea why my loop does not work properly. can anyone point out to me why is it so? can i code like this? i'm really sorry im an idoit with this.



If Request("Go")="Go" then

i = request.form("item")

opt = request.form("opt")

sql31 = "Select * from ABS "
Set Rs31 = Server.CreateObject("ADODB.RecordSet")
Rs31.open sql31,conn

sql32 = "Select * from ABSSubGrade where Item = '"&opt&"'"
Set Rs32 = Server.CreateObject("ADODB.RecordSet")
Rs32.open sql32,conn

%>
<table width="817" border="1" cellspacing="1" cellpadding="4">
<tr>
<td colspan="7"><font color="#000000" size="4">Modified ABS</font></td>
</tr>
<tr>
<td width="239" rowspan="2"><div align="center"><font color="#000000">Item</font></div></td>
<td width="121" rowspan="2"><div align="center"><font color="#000000">Test Method</font></div></td>
<td width="86" rowspan="2"><div align="center"><font color="#000000">Unit</font></div></td>
<td width="158" rowspan="2"><div align="center"><font color="#000000">Test Condition</font></div></td>
<td width="155"><div align="center"><%=RS32("GradeName")%></div></td>
</tr>
<tr>
<td><div align="center"><%=opt%></div></td>
</tr>
<tr>
<% Do while not rs31.eof%>
<% Do while not rs32.eof%>
<td><div align="center"><%=RS31("Item")%></div></td>
<td><div align="center"><%=RS31("Method")%></div></td>
<td><div align="center"><%=RS31("Unit")%></div></td>
<td><div align="center"><%=RS31("TestCon")%></div></td>
<td><div align="center"><%=RS32("Grade")%></div></td>
</tr>
<%
rs32.movenext
loop
%>
<%
rs31.movenext
loop
%>
</table>



do i have to insert another table to acheive the desired results? at the moment, only one recordset works. if i will to put rs1.movenext before rs2.movenext, rs2 only displays the first record. help!

leeny
02-14-2005, 01:13 AM
i've solved it. i should place both the movenext together.