Dynamic Variable Naming and Reference (ColdFusion)

One Option: Setting a dynamic variable name: <cfset variables[“GC” & AID] = “Testing” /> Output the value of the dynamic variable name: <cfoutput>#variables[“GC” & AID]#</cfoutput> Another Option: Setting a dynamic variable name: <cfset variables[“GC#AID#”] = “Testing” /> Output the value of the dynamic variable name: <cfoutput>#variables[“GC#AID#”]#</cfoutput>

ColdFusion Parameterizing a Query

I don’t get any CFErrors on the screen but my CFChart is blank. Ignoring the correct approach for a moment, the reason that happens is that you are using the incorrect cfsqltype for the parameters. So you are actually sending different values to the database (and consequently performing a different comparison) than you are thinking. … Read more

ColdFusion adding extra quotes when constructing database queries in strings

ColdFusion, by design, escapes single quotes when interpolating variables within <cfquery> tags. To do what you want, you need to use the PreserveSingleQuotes() function. <cfquery …>#PreserveSingleQuotes(query)#</cfquery> This doesn’t address, however, the danger of SQL injection to which you are exposing yourself. Using <cfqueryparam> also allows your database to cache the query, which in most cases … Read more

How to suppress the file corrupt warning at Excel download?

If you don’t want to look for a solution, but just want to solve the problem, insert this key in your registry to suppress the notification: [HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Security] “ExtensionHardening”=dword:00000000 You can accomplish the above by doing the following: Open your Registry (Start -> Run -> regedit.exe) Navigate to HKEY_CURRENT_USER\SOFTWARE\MICROSOFT\OFFICE\12.0\EXCEL\SECURITY Right click in the right window and … Read more