home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 1999 April / APC443.iso / features / grpware / coldfus / coldfusi.exe / data1.cab / Documentation / snippets / querysetcell.cfm < prev    next >
Encoding:
Text File  |  1998-10-08  |  1.0 KB  |  40 lines

  1. <!--- This example shows the use of QueryAddRow and QuerySetCell --->
  2. <HTML>
  3. <HEAD>
  4. <TITLE>
  5. QuerySetCell Example
  6. </TITLE>
  7. </HEAD>
  8.  
  9. <BODY>
  10. <H3>QuerySetCell Example</H3>
  11.  
  12. <!--- start by making a query --->
  13. <CFQUERY NAME="GetCourses" DATASOURCE="cfsnippets">
  14. SELECT     Course_ID, Number, Descript 
  15. FROM     Courses
  16. </CFQUERY>
  17.  
  18. <P>The Query "GetCourses" has <CFOUTPUT>#GetCourses.RecordCount#</CFOUTPUT> rows.
  19.  
  20. <CFSET CountVar = 0>
  21. <CFLOOP CONDITION="CountVar LT 15">
  22.  
  23. <CFSET temp = QueryAddRow(GetCourses)>
  24. <CFSET CountVar = CountVar + 1>
  25. <CFSET Temp = QuerySetCell(GetCourses, "Course_ID", CountVar)>
  26. <CFSET CountVar = CountVar + 1>
  27. <CFSET Temp = QuerySetCell(GetCourses, "Number", 100*CountVar)>
  28. <CFSET CountVar = CountVar + 1>
  29. <CFSET Temp = QuerySetCell(GetCourses, "Descript", "Description of variable #Countvar#")>
  30.  
  31. </CFLOOP>
  32.  
  33. <P>After the QueryAddRow action, the query has <CFOUTPUT>#GetCourses.RecordCount#</CFOUTPUT> records.
  34. <CFOUTPUT query="GetCourses">
  35. <PRE>#Course_ID#    #Number#    #Descript#</PRE>
  36. </CFOUTPUT>
  37.  
  38. </BODY>
  39. </HTML>       
  40.