Sean,
Try using Replace() where you replace the " ' " with " ' "...it will look
like the following...
Values('#Trim(Replace(Message, "'", "'", "ALL") )#')
Strange I know, but it works.
Regards,
Blighty.
----- Original Message -----
From: Sean Renet <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 06, 2000 6:18 PM
Subject: escaping apostrophes for database insertion.
> Lets say I have a variable called message.
>
> Message looks like:
>
> <cfset message = "I can't make it today">
>
> I want to input it into a database:
>
> <cfquery name="myquery" ...>
> insert into mytable(MESSAGE_MEM)
> values('#trim(Message)#')
>
> </cfquery>
>
> Because CF thinks the apostrophe in "can't" is closing the inserting
> variable I get this error.
> ODBC Error Code = 37000 (Syntax error or access violation)
>
>
> [Microsoft][ODBC SQL Server Driver][SQL Server]Line 10: Incorrect syntax
> near 't'.
>
>
>
> What is the trick for escaping the apostrophe?
>
>
> --------------------------------------------------------------------------
----
> Archives: http://www.mail-archive.com/[email protected]/
> To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.