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

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