Printing database fields

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Printing database fields

    Okay, stuck with CF4.5. No biggy. I just want to pull data from a db and make
    an xml file out of it. BUT I want it to be generic and fast. to code.

    I know by the time I get an answer I could have it coded the long way so this
    is for future reference.

    What I want to do is run my query then do something like this:
    <MYXML>
    <cfoutput query="myQuery">
    <OUTPUT #fieldname#="#db data#">
    </cfoutput>

    So how do I get the field name from the query or can I? Pretty sure I've seen
    it done before.

    Dinghus Guest

  2. Similar Questions and Discussions

    1. font missing shows during printing of forms fields
      To use interactive form fill I scanned my existing form and used as a watermark in the background and create an interactive form fields on top of it...
    2. Inserting value into database based on other fields
      Hi, I have 3 fields in a form: CATEGORY, NUMBER and YEAR. In addition to inserting these 3 fields into a database table, I would like to insert a...
    3. Blank fields in database
      Hi, I have a blank field in the database for Address. How do I refer to that? For ex: Set hrRS = Server.CreateObject("ADODB.Recordset") ...
    4. Do Database fields have a numeric equavilant?
      Does Access 2000 actually allocate an numerical reference for each field even if I have given the field a name of my own? Thanks in advance TP
    5. HotSpot and Database fields
      Is it possible to have a hotspot call on a database field for popup information?
  3. #2

    Default Re: Printing database fields

    query_name.columnList will give you a list of the column names

    So, of the top of my head

    <MYXML>
    <cfloop from="1" to="#myQuery.RecordCount#" index="idx">
    <cfloop index="listElement" list="#myQuery.columnList">
    <OUTPUT #listElement#="#myQuery[listElement]#">
    </cfloop>

    Ken


    The ScareCrow Guest

  4. #3

    Default Re: Printing database fields

    strange happenings.

    I had to make a few small changes to get it to work:

    <MYXML>
    <cfloop from="1" to="#myQuery.RecordCount#" index="idx">
    <cfloop index="listElement" list="#myQuery.columnList">
    <cfoutput>
    <cfset outVar=#myQuery[#listElement#]#>
    <OUTPUT #listElement#=>#outvar#</OUTPUT>
    </cfoutput>
    </cfloop>
    </cfloop>

    not sure why it needs to have the extra step in there but it works which will
    save time and code. :)

    Dinghus Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139