"Dave" wrote in message news:...
: If so, what is wrong with this code in APS 3.0?
:
: I open a recordset with order info. Each record contains the order header
: info plus a line item from the order detail. So the recordset looks
: something like this:
:
: Orderid PartID
: 1 12
: 1 87
: 2 99
: 2 33
:
:
: The web page should display as:
:
: Order 1
: Part 12
: Part 87
:
: Order 2
: Part 99
: Part 33
This assumes something similar:
strSQL = "SELECT orderid, partid FROM tParts ORDER BY orderid, partid"
set rs = conn.Execute(strSQL)
or a stored query/procedure: (qOrdersParts)
set rs = CreateObject("ADODB.Recordset")
conn.qOrdersParts, rs
dim row, col, order, arr
if not (rs.bof or rs.eof) then
arr = rs.GetRows
prt "<table>"
order = 0
prt "<tr><td>Order " & order & "</td></tr>"
for row = 0 to ubound(arr,2)
if arr(0, row) = order then
prt "<tr><td>Part " & arr(1, row) & "</td></tr>"
else
order = arr(0, row)
prt "<tr><td>Order " & order & "</td></tr>"
prt "<tr><td>Part " & arr(1, row) & "</td></tr>"
end if
next
end if
sub prt(str)
Response.Write str & vbCrLf
end sub
It's untested but looks right at 2:30am. (O:=
--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center -
http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation -
http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library -
http://msdn.microsoft.com/library/default.asp