Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

requesting data from a recordset

Status
Not open for further replies.

FranckM

Programmer
May 8, 2002
76
CA
This is what i'm doing right now:

set rs2 = Server.CreateObject ("ADODB.Recordset")
rs2.Open "select distinct P1.number, p2.number
from part p1, part p2
where P1.number = P2.number(+)

Later in the code I use the following to use that information in the table

<% do while not rs.EOF %>
<td>
<%=rs(&quot;number&quot;)%>
</td>
<% rs.movenext
loop
rs.Close
%>

and I get the first number, but I also want the second number, i've tryed using P1.number, but then I get an error.

Any ideas?

Thanks for reading.
 
I solved it ;) Here's the solution, you give a name to what you want to select select p1.number as p1number, htne you use p1number instead of number and it works. Can I put myself as having a useful post? haaaa guess not eheh.
 
Try aliasing the 2 fields :
Code:
set rs2 = Server.CreateObject (&quot;ADODB.Recordset&quot;)
rs2.Open &quot;select distinct P1.number NumberFromP1, p2.number NumberFromP2
from part p1, part p2
where P1.number = P2.number(+) 
<% do while not rs.EOF %>
    <td>
     <%=rs(&quot;NumberFromP1&quot;)%>
     </td>
     <td>
      <%=rs(&quot;NumberFromP2&quot;)%>
     </td>
     <% rs.movenext 
        loop
        rs.Close
     %>

This assumes there IS a NumberFromP2 - you could do a check before the display and handle it in some way...

hth,
[profile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top