The following works just fine for me with cfmx and sql 2000: (watch wrap)

<cfscript>
function convertText(inText) {
        var convertedText = "";
        if (len(trim(inText))) {
                convertedText = replace(replace(inText, chr(10), "", "ALL"),
chr(13), "<br />#chr(13)#", "ALL");
        }
        return convertedText;
}
</cfscript>

<cfsavecontent variable="textstr">
This is my content. Not Snake's content. But mine.

I am having a lot of fun.
</cfsavecontent>

<cfset txttemp = convertText(textstr)>

<cfquery name="test" datasource="#dsn#">
INSERT INTO test(textcol)
VALUES('#txttemp#')
</cfquery>

> -----Original Message-----
> From: Snake Hollywood [mailto:[EMAIL PROTECTED]
> Sent: 26 September 2003 11:11
> To: [EMAIL PROTECTED]
> Subject: RE: [ cf-dev ] CFMX and single quotes
> 
> 
> It's a simple insert.
> 
> <cfset texttemp ="#textareaformat(form.description)#">
> 
> <CFQUERY   datasource="#request.HelpdeskDSN#"
> username="#request.helpdeskDBusername#"
> password="#request.helpdeskDBpassword#">
> insert into ticketdata (taskID,trackID,created,name,details)
> values(
> #lastticket.taskID#,'#trackID#',#now()#,'#form.name#','#texttemp#')
> </cfquery>
> 
> TextareaFormat simply replaces CR and NEWLINE with <BR>
> It is set outside the query because CF5 also balks on single quotes if
> you use a function on a string inside the query itself. It 
> seems to not
> escape quotes if you perform any function on the string first.
> 
> To make this work in CFMx I have strippe dout the quotes for now.
> 
> 
> > -----Original Message-----
> > From: Rich Wild [mailto:[EMAIL PROTECTED] 
> > Sent: 26 September 2003 11:00
> > To: '[EMAIL PROTECTED]'
> > Subject: RE: [ cf-dev ] CFMX and single quotes
> > 
> > 
> > huh? whatchoo talking bout willis?
> > 
> > Of course CFMX escapes single quotes. You'd think the whole 
> > CF developer world would have discovered something like 
> that by now! 
> > 
> > I've got a million apps (slight exaggeration) accepting text 
> > with single quotes and inserting them into SQL server just 
> > fine. It must be something else wrong.
> > 
> > have you got an example?
> > 
> > > -----Original Message-----
> > > From: Snake Hollywood [mailto:[EMAIL PROTECTED]
> > > Sent: 26 September 2003 10:57
> > > To: [EMAIL PROTECTED]
> > > Subject: RE: [ cf-dev ] CFMX and single quotes
> > > 
> > > 
> > > Well it wasn't using it in the first place when it broke. 
> > CF5 escapes 
> > > them, cfmx doesn't I guess. How annoying.
> > > 
> > > 
> > > > -----Original Message-----
> > > > From: Tom Smith [mailto:[EMAIL PROTECTED]
> > > > Sent: 26 September 2003 10:36
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Re: [ cf-dev ] CFMX and single quotes
> > > > 
> > > > 
> > > > I thought preservesinglequotes() prevents coldfusion from
> > > > automatically escaping single quotes...  try it without:)
> > > > ----- Original Message ----- 
> > > > From: "Snake Hollywood" <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Friday, September 26, 2003 10:33 AM
> > > > Subject: RE: [ cf-dev ] CFMX and single quotes
> > > > 
> > > > 
> > > > It's access.
> > > > And preservesinglequotes always used to escape them fine. Has
> > > > this broken in CFMX ? And yes I am am only just getting 
> > > > around to porting code over to CFMX.
> > > > 
> > > > 
> > > > > -----Original Message-----
> > > > > From: Stephen Pope [mailto:[EMAIL PROTECTED]
> > > > > Sent: 26 September 2003 09:54
> > > > > To: [EMAIL PROTECTED]
> > > > > Subject: RE: [ cf-dev ] CFMX and single quotes
> > > > >
> > > > >
> > > > > Also .. what DB is it ? :�)
> > > > >
> > > > > -----Original Message-----
> > > > > From: Steve Martin [mailto:[EMAIL PROTECTED]
> > > > > Sent: 26 September 2003 09:53
> > > > > To: [EMAIL PROTECTED]
> > > > > Subject: RE: [ cf-dev ] CFMX and single quotes
> > > > >
> > > > > You need to escape single quotes. Show us yer code.
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Snake Hollywood [mailto:[EMAIL PROTECTED]
> > > > > > Sent: 26 September 2003 09:46
> > > > > > To: [EMAIL PROTECTED]
> > > > > > Subject: [ cf-dev ] CFMX and single quotes
> > > > > >
> > > > > >
> > > > > > Just uploaded a site onto CFMX, works fine even though it
> > > > > was done on
> > > > > > CF5. But database inserts where a single quote ' is 
> > in the text
> > > > > > fails on CFMX with a meaningless DB error, using 
> > > > > > preservesinglequotes and all that has
> > > > > > made no difference.
> > > > > > What's the hooky reason for this then ?
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > ** Archive:
> > > > > http://www.mail-archive.com/dev%> 40lists.cfdeveloper.co.uk/
> > > > > >
> > > > >
> > > > > > To unsubscribe, e-mail:
> > > > > [EMAIL PROTECTED]
> > > > > > For additional commands, e-mail:
> > > > > [EMAIL PROTECTED] For
> > > > > > human help, e-mail: [EMAIL PROTECTED]
> > > > > >
> > > > > >
> > > > >
> > > > > --
> > > > > ** Archive:
> > > > http://www.mail-archive.com/dev%> 40lists.cfdeveloper.co.uk/
> > > > >
> > > > 
> > > > > To unsubscribe, e-mail:
> > > > [EMAIL PROTECTED]
> > > > > For additional commands, e-mail:
> > > > [EMAIL PROTECTED] For
> > > > > human help, e-mail: [EMAIL PROTECTED]
> > > > >
> > > > >
> > > > > --
> > > > > ** Archive:
> > > > http://www.mail-archive.com/dev%> 40lists.cfdeveloper.co.uk/
> > > > >
> > > > 
> > > > > To unsubscribe, e-mail:
> > > > [EMAIL PROTECTED]
> > > > > For additional commands, e-mail:
> > > > [EMAIL PROTECTED] For
> > > > > human help, e-mail: [EMAIL PROTECTED]
> > > > >
> > > > >
> > > > 
> > > > 
> > > > 
> > > > --
> > > > ** Archive: 
> > http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> > > 
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > > [EMAIL PROTECTED] For human help, e-mail: 
> > > [EMAIL PROTECTED]
> > > 
> > > 
> > > --
> > > ** Archive: 
> > http://www.mail-archive.com/dev%> 40lists.cfdeveloper.co.uk/
> > > 
> > 
> > > To unsubscribe, e-mail: 
> > [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > > [EMAIL PROTECTED] For human help, e-mail: 
> > > [EMAIL PROTECTED]
> > > 
> > > 
> > 
> > 
> > 
> > -- 
> > ** Archive: 
http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: 
> [EMAIL PROTECTED] For human help, e-mail: 
> [EMAIL PROTECTED]
> 
> 
> -- 
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: 
> [EMAIL PROTECTED] For human help, e-mail: 
> [EMAIL PROTECTED]
> 
> 



-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]


--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to