Skip to main content
Participant
January 15, 2009
Answered

Dynamic Mesaage Building - SQL Dangling Apostrophe

  • January 15, 2009
  • 2 replies
  • 345 views
Hi,

I have the following issue..and hoping that someone out there can be of assitance.
I have inherited a coldfusion app and bugs seem to be always close by..
The issue i am having is as follows:
1) A SQL query that inserts a row containg an email msg into a comms audit table and includes the whole html formatted email
2)The sql query however is defined as follows as attached
3) The error returns is a SQL one as is related to a dangling apostrophe in the <cfinclude> part of the query (The template creates an html formatted message based on various queries etc.)

My question is how do ensure that intergrity of the message and prevent this error?
I have already looked into using 'preservesinglequotes' and cfqueryparam - however with no luck..
This topic has been closed for replies.
Correct answer Newsgroup_User
before your query do:
<cfsavecontent variable="emailmessagebody"><cfinclude
template="#mancbPath#/mancb_body.cfm"></cfsavecontent>

then in your query instead of using '<cfinclude ...>' use
'#emailmessagebody#'

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/

2 replies

Participant
January 15, 2009
Thanks, this seems to work quite well
Newsgroup_UserCorrect answer
Inspiring
January 15, 2009
before your query do:
<cfsavecontent variable="emailmessagebody"><cfinclude
template="#mancbPath#/mancb_body.cfm"></cfsavecontent>

then in your query instead of using '<cfinclude ...>' use
'#emailmessagebody#'

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/