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

  1. #1

    Default CFML from MSSQL

    I am attempting to pull CFML, <cfoutput>'s, etc. from a database and have them
    inserted into a .cfm page and executed at runtime. Instead of the CFML tags
    are stripped and all the code within the <cf*> tags is displayed literally.

    Example:

    <cfquery name="qUsername" datasource="SQLServer" username="*****"
    password="*****">
    SELECT * FROM dbo.websiteUsers WHERE dbo.websiteUsers.lastname =
    '<cfoutput>#URL.lastname#</cfoutput>' AND dbo.websiteUsers.firstname =
    '<cfoutput>#URL.firstname#</cfoutput>' AND dbo.websiteUsers.username =
    '<cfoutput>#URL.username#</cfoutput>' AND dbo.websiteUsers.email =
    '<cfoutput>#URL.email#</cfoutput>'
    </cfquery>

    displays literally:

    SELECT * FROM dbo.websiteUsers WHERE dbo.websiteUsers.lastname =
    '#URL.lastname#' AND dbo.websiteUsers.firstname = '#URL.firstname#' AND
    dbo.websiteUsers.username = '#URL.username#' AND dbo.websiteUsers.email =
    '#URL.email#'

    How can I pull CFML from a database and have it execute on the .cfm?

    I've posed this question on [url]www.experts-exchange.com[/url] and the 'expert' told me
    it couldn't be done...I'm really hoping he is wrong.
    -adam.

    KingScooby Guest

  2. Similar Questions and Discussions

    1. Flash and CFML
      I just posted this same question but was in the wrong section of the forums. I am very new to flash but can definitely see the potential of this...
    2. CFML to HTML
      Is there a way to convert a whole ecommerce site with all of it's many products from CFML to HTML for easy spidering? I haven't found any snippets...
    3. convert ASP to CFML
      I purchased an RSS feed from coolfocus.com. This applet contains an ASP script. I am attempting to convert this from ASP to CFML. I dont know how...
    4. CFML & MySQL
      Can I use CFML with MySQL? at the moment I am using CFML with MS Access. Can I use the same CFML code with MySQL? Dario
    5. use cfml in JS
      Hi Is it possible to use ColdFusion functions in Javacript ? e.g. (won't work) <script language="JavaScript" type="text/javascript"> <!--...
  3. #2

    Default Re: CFML from MSSQL

    > I am attempting to pull CFML, <cfoutput>'s, etc. from a database and have
    them
    > inserted into a .cfm page and executed at runtime. Instead of the CFML
    tags
    > are stripped and all the code within the <cf*> tags is displayed
    literally.
    >
    > Example:
    >
    > <cfquery name="qUsername" datasource="SQLServer" username="*****"
    > password="*****">
    > SELECT * FROM dbo.websiteUsers WHERE dbo.websiteUsers.lastname =
    > '<cfoutput>#URL.lastname#</cfoutput>' AND dbo.websiteUsers.firstname =
    > '<cfoutput>#URL.firstname#</cfoutput>' AND dbo.websiteUsers.username =
    > '<cfoutput>#URL.username#</cfoutput>' AND dbo.websiteUsers.email =
    > '<cfoutput>#URL.email#</cfoutput>'
    > </cfquery>
    >
    > displays literally:
    >
    > SELECT * FROM dbo.websiteUsers WHERE dbo.websiteUsers.lastname =
    > '#URL.lastname#' AND dbo.websiteUsers.firstname = '#URL.firstname#' AND
    > dbo.websiteUsers.username = '#URL.username#' AND dbo.websiteUsers.email =
    > '#URL.email#'
    >
    > How can I pull CFML from a database and have it execute on the .cfm?
    >
    > I've posed this question on [url]www.experts-exchange.com[/url] and the 'expert'
    told me
    > it couldn't be done...I'm really hoping he is wrong.
    You need to write the content to a temporary file, cfinclude that file, then
    delete it (to keep the place clean).

    --
    <mack />


    Neculai Macarie Guest

  4. #3

    Default Re: CFML from MSSQL

    Thanks for your response.

    Would you be so kind as to provide some sample code?
    KingScooby Guest

  5. #4

    Default Re: CFML from MSSQL

    > Thanks for your response.
    >
    > Would you be so kind as to provide some sample code?
    Something like this (untested):
    <cffile action="write" file="#ExpandPath('.')#/temp.cfm"
    output="#query.cfml_code_field#">

    <cfinclude template="temp.cfm">

    <cffile action="delete" file="#ExpandPath('.')#/temp.cfm">

    --
    <mack />


    Neculai Macarie 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