EasyCFM.COM ColdFusion Forums / MS SQL Server Related Issues / how to format stored procedures

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: how to format stored procedures

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

faisalguru
04-20-2007 @ 12:24 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 29
Joined: Oct 2006

Hello All... I am using CF and SQL server to build some script pages...but the problem is i am storing the queries as Stored procedures and callin it from CFML.. but the problem is when u call the SProcs from CF.. you cant format the dataset?? which means i am trying to change colors for the dataset, change borders,alternating grid color..
I am attaching the record set that is being generated through stored procedures but I cant format the dataset..
I have attached a copy of the image of how it displays when i call it from CF
http://www.gamaus.com/a.jpg


nmiller
04-20-2007 @ 12:45 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 773
Joined: Apr 2003

this looks like you're doing a cfdump (possibly?).

Can you post the CF code that is producing this output?  

Normally to format results you do a cfoutput query around table tags, and apply your styles to the html table.

Nathan Miller
NM Consulting

faisalguru
04-20-2007 @ 1:11 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 29
Joined: Oct 2006

yes sir you are correct that I am doing a cf dump..but i dont know any other way to change the style of the dataset..
here is the code
<cfstoredproc procedure="spgetdeliveryholdsummary" datasource="hold">
  <cfprocresult name="result" resultset="1">
</cfstoredproc>
<cfdump var="#result#">

nmiller
04-20-2007 @ 1:21 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 773
Joined: Apr 2003

You need to output the results in an HTML table:

<style type="text/css">
table.chart { border: 1px solid #999; border-collapse:collapse;}
table.chart tr {background-color: #FFF; }
table.chart td{     text-align: left; padding: 4px; vertical-align:top; border: 1px solid #999; }
table.chart th{ text-align: center; font-weight: bold; color: #fff; padding: 2px 4px 2px 4px; background-color: #B34826; border: 1px solid #999; }
</style>

<cfstoredproc procedure="spgetdeliveryholdsummary" datasource="hold">
  <cfprocresult name="result" resultset="1">
</cfstoredproc>

<table class="chart">
     <tr>
          <th>Item Lookup Code</th>
          <th>Description</th>
          <th>Price</th>
          <th>Qty</th>
          <th>Total</th>
     </tr>
     <cfoutput query="result">
     <tr>
          <td>#itemlookupcode#</td>
          <td>#Description#</td>
          <td>#dollarformat(Price)#</td>
          <td>#Qty#</td>
          <td>#Total#</td>
     </tr>     
     </cfoutput>
</table>

also, you'll want to remove any pound signs from column names otherwise CF will get messed up.

Nathan Miller
NM Consulting

This message was edited by nmiller on 4-20-07 @ 1:21 PM


Website Designed and Developed by Pablo Varando.