[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

multiple recordset outputs with asp

Posted on 2011-10-05
1
Medium Priority
?
213 Views
Last Modified: 2012-05-12
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)
0
Comment
Question by:nevyana2006
1 Comment
 
LVL 15

Accepted Solution

by:
pateljitu earned 2000 total points
ID: 36917353
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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question