p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_howto thread: NextRecordSet Problem, HELP PLEASE


Message #1 by "Ojeda, Donald" <DonaldOjeda@T...> on Mon, 13 Mar 2000 17:10:07 -0500
Form your code I get that you want each table row to contain the details
of a single recordset, and that each table cell should be one row from
the recordset. In this case you'd want something like this (I've left
out the formatting stuff to make it easier to read):

<%
	SQL = "EXEC usp_AIAdvisorTotals"
	rsRM.Open SQL, myConnect

	response.write "<table>"

	' first recordset
	response.write "<tr>"
	while not rsRM.EOF
		response.write "<td>" & rsRM("Total Assets") & "</td>"
		rsRM.MoveNext
	wend
	response.write "</tr>"

	' next recordset
	response.write "<tr>"
	rsRM.NextRecordset
	while not rsRM.EOF
		response.write "<td>" & rsRM("countofregreps") & "</td>"
		rsRM.MoveNext
	wend
	response.write "</tr>"

	response.write "</table>"
%>


You are better of not switching in and out of code, especially within a
loop, since this will slow your page down.

Dave


"Ojeda, Donald" <DonaldOjeda@T...> wrote in message
news:<6553BCF3E25DD2118F0A00AA00AE6AAA197604@t...>...
> Dear Group,
>         I am trying to develop a page that executes a stored procedure
that
> returns  back multiple recordsets.  The problem is that I do not know
where
> to call NextRecordset in my page to return the next recordset,
instead I
> only get the first recordset.
> 
> I have included the code any help would be greatly appreciated!!
> 
>  <%
> 
> Dim SQL 'SQL string
> 	rsRM.CursorLocation = 3
> 	myConnect.ConnectionTimeout = 300
> 	myConnect.CommandTimeout = 300
> 	myConnect.Open Application("Connect_String")
>    'Build SQLString
> 	SQL = "EXEC usp_AIAdvisorTotals"
> 	rsRM.Open SQL, myConnect
>  'If it is not the End of the File then
>       if not rsrm.EOF then 
>       Do Until rsRM.EOF
>  %>     
>   <tr>
>   <%
>         Response.Write "<TD align=middle><Font face=Arial size=2>" &
> (formatcurrency (rsRM.Fields ("Total Assets"),2)) & "</font></TD>" 
>   %>	      
> 
> </tr>	      
> 
>         <!--   THE SECOND RECORDSET TO BE DISPLAYED IS BELOW  -->
> <tr>
>  <%         
> 	Response.Write "<TD align=middle><Font face=Arial size=2>" &
> (rsRM.Fields ("countofregreps")) & "</font></TD>"     
>  %>
> </tr>     
> <%	
>  rsRM.moveNext
>  Loop
>  end if
>  %>
>       
> 
ProASP3HowTo@i...
$subst('Email.Unsub')

  Return to Index