Get database field names from table...

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

  1. #1

    Default Get database field names from table...

    How do you get the database fieldnames from a table and display them using cfquery and cfoutput.

    Thanks a million...
    bweno Guest

  2. Similar Questions and Discussions

    1. Database table names
      In the database tab of the Application panel, when I go down the hierachy to the tables dreamweaver shows the full path instead of just the table...
    2. querying field / column names in Access table
      I got great info on my last post, so let's try this one and see if my luck is still good: I have an Access table with about 30+ columns / fields...
    3. querying table names in a database
      Hey Gang - Anyone have a fast and easy CFQUERY that can query all the table names in an Access database? TIA
    4. Table field names not visible
      This morning I set up check in and check out to work on a site with someone else. Suddenly when looking at bindings details or any of the other...
    5. interrogating database for field names/datatypes?
      I'm working primarily in ASP and transitioning to ASP.NET. This is probably entered to the wrong group but I'm not sure of what precise database...
  3. #2

    Default Re: Get database field names from table...

    Assuming you've run a query returning one row and want to display details
    (alphabetically, see below). This example is for one record listing the fields
    top to bottom, label/value. If you want to show a bunch of records all at
    once with horizontal columns (a la Excel) <cfgrid> will do it for you
    automatically. <cfset colList = yourQuery.ColumnList> <cfloop index='ColName'
    list='#colList#'> <tr> <cfoutput> <td align=right><b>#colName#:</b></td>
    <td>#Evaluate('yourQuery.' &amp; colName)#<br></td> </cfoutput> </tr> </cfloop>
    You can also find/download a Custom tag to get them in physical DB sequence:
    <CF_ColumnList Query='#yourQuery#' ColumnList='colList'>

    JMGibson3 Guest

  4. #3

    Default Re: Get database field names from table...

    That works great!!!! The cf_ tag is awesome... Is there anyway to set to a list
    of the values of the fields. The cf_ tag use a loop statement and everytime I
    try and set it to a list and then output it comes up just showing the last
    field value... Thanks in advance for all your help! <cfloop list='#colList#'
    index='col'> <cfoutput> <cfset thelist = ''> <cfset thelist =
    listappend(thelist, '#col#')> </cfoutput> </cfloop> <cfoutput> #thelist#
    </cfoutput>

    bweno 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