Skip to main content
Inspiring
February 1, 2011
Question

display stored procedure output

  • February 1, 2011
  • 1 reply
  • 3175 views

I have a simple stored procedure listed below. I cannot find any examples of how to display the output.  I did a cfdump and it successfully displayed the data.

I need to know how to output the results so I can format it and have a user make sense out of it.

Thank you,

Jim

<cfstoredproc procedure="dbo.spxSpendingPlanByBiennium" datasource="rolProjects">

<cfprocresult name="results" resultset="1">


</cfstoredproc>

   
<cfdump var="#results#">

    This topic has been closed for replies.

    1 reply

    Inspiring
    February 1, 2011

    The result is a query object. So you display it the same way you would any query. Loop through it and output the column values ie #result.columnName#

    rockhikerAuthor
    Inspiring
    February 2, 2011

    Thank you I was able to display the results but the fields are not in the correct order. Is there a way to reorder them?

    </cfif

    rockhikerAuthor
    Inspiring
    February 2, 2011

    Thank you I was able to display the results but the fields are not in the correct order. Is there a way to reorder them?

    <cfif IsDefined("results.ColumnList")>

    <table border="1">

    <tr><cfloop list="#results.ColumnList#" index="col" delimiters=","> <th align="left" nowrap><cfoutput>#col#</cfoutput></th>

    </cfloop></tr>

      

    <cfoutput query="results">

    <tr><cfloop list="#results.ColumnList#" index="col"> <td align="left" nowrap>#results[col][CurrentRow]#</td></cfloop></tr>

    </cfoutput>

    </table>

    </cfif>