multiple recordset outputs with asp

hi, i have these two recordsets returned from sql procedures - how can i group them in a asp report ?

customerid,chargeid,desc,q'ty,unit_price
1,100,mrc,1,10.00
1,100,ld,1,60.00
1,100,void,-1,(60.00)

customerid,chargeid,payment_type,value
1,100,cash,20.00
1,100,change,(10.00)

report output:
customerid:1,chargeid:100
mrc,1,10.00
ld,1,60.00
void,-1,(60.00)
cash,20.00
change,(10.00)
nevyana2006Asked:
Who is Participating?
 
pateljituCommented:
Please see attached code reference, also see article that explains how to work with multiple recordset:

http://databases.aspfaq.com/database/how-do-i-deal-with-multiple-resultsets-from-a-stored-procedure.html
<%
dim strMainOutput, strOutput
SQL = "select 1 as customerid, 100 as chargeid, 'mrc' as [desc], 1 as [q'ty], '10.00' as unit_price UNION ALL "_ 
    &" select 1 as customerid, 100 as chargeid, 'il' as [desc], 1 as [q'ty], '60.00' as unit_price UNION ALL  "_ 
    &" select 1 as customerid, 100 as chargeid, 'vois' as [desc], -1 as [q'ty], '(60.00)' as unit_price  "_ 
    &" select 1 as customerid, 100 as chargeid, 'cash' as payment_type, '20.00' as value union all "_ 
    &" select 1 as customerid, 100 as chargeid, 'change' as payment_type, '10.00' as value "

set rs = conn.Execute(SQL)

if not RS.eof then
    Do while not rs.EOF
        
        strMainOutput = "customerId: "& rs("customerId") &", chargeId:"& rs("chargeid") &"<br>"
        strOutput = strOutput & rs("desc") &","& rs("q'ty") &", "& rs("unit_price")&"<br>"
        
    rs.MoveNext
    loop
end if

set rs = rs.nextRecordset()
if not RS.eof then
    Do while not rs.EOF
        
        strOutput = strOutput & rs("payment_type") &","& rs("value") &"<br>"
        
    rs.MoveNext
    loop
end if

Response.Write(strMainOutput & strOutput)

%>

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.