Need help with preservesinglequotes() while inseting.
Hi All, I am having hard time with preservesinglequotes() function in access table. I have a insert statement with following cfquery datasource=#request.dsn# name=insItem dbtype=ODBC INSERT INTO products ( id, state, sku, keywords, meta_description, image_a, image_b, title, short_description, content, taxable, price, build_date, edit_date, admin_user, ship_code, meta_title, vendorid ) VALUES( '#trim(variables.newid)#', #trim(getitem.Active)#, '#trim(GetItem.sku)#', '#trim(preservesinglequotes(getitem.kws))#', '#trim(preservesinglequotes(getitem.descs))#', '#trim(preservesinglequotes(getitem.image))#', '#trim(preservesinglequotes(getitem.image2))#', '#trim(preservesinglequotes(getitem.name))#', '#trim(preservesinglequotes(getitem.title))#', '#trim(preservesinglequotes(getitem.description))#', 1, '#trim(getitem.price)#', #CreateODBCDateTime(todayDate)#, #CreateODBCDateTime(todayDate)#, 'demo', 0, '#trim(preservesinglequotes(getitem.thetitle))#, '#trim(getitem.VID)#' ) /cfquery Following are the values getting inserted in to my access table INSERT INTO products ( id, state, sku,keywords, meta_description, image_a, image_b, title, short_description, content, taxable, price, build_date, edit_date, admin_user, ship_code, meta_title, vendorid ) VALUES( 'E72168FA-988F-455F-9CB6615CB6181EC1', 1, 'BEY-SQ509-SHIPSWHEELCLOCK', '13 1/2 Brass/Oak Ship's Wheel Clock,nautclocks,nautical gifts,ocean gifts,sea themed gifts', 'Nautical Gifts Online carries and other nautclocks.Quartz clock in solid brass tarnishproof porthole, solid oak ship's wheel.brDia: 13 1/2, D: 3 1/2', '/weather/SQ509.jpg', '', '13 1/2 Brass/Oak Ship's Wheel Clock', '13 1/2 Brass/Oak Ship's Wheel Clock from White Marlin Designs.', 'Quartz clock in solid brass tarnishproof porthole, solid oak ship's wheel.brDia: 13 1/2, D: 3 1/2', 1, '231.', {ts '2004-01-08 15:15:02'}, {ts '2004-01-08 15:15:02'}, 'ocean', 0, '13 1/2 Brass/Oak Ship's Wheel Clock - nautclocks at Nautical Gifts Online, 'DD9036B6-8C91-41E6-ABEC1157E85B86F4' ) Ketan Patel G3 Technology Group, LLC Graphics III Advertising, Inc. (410)789-7007 or (800)783-1799 It's Not Creative if it doesn't Sell. http://www.g3group.com http://www.g3group.com [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Need help with preservesinglequotes() while inseting.
You are using preservesinglequotes in the wrong. Normally you use it when you have escaped single quotes yourself and don't want CF to. In your case, you are NOT escaping single quotes, so you should remove the call and let CF handle it. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Need help with preservesinglequotes() while inseting.
Hi Ray, Its does not likein my insert statement this: '13 1/2 Brass/Oak Ship's Wheel Clock,nautclocks,nautical gifts,ocean gifts,sea themed gifts', It doe snot like the single quote I think . Ketan Patel -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED] Sent: Thursday, January 08, 2004 3:41 PM To: CF-Talk Subject: RE: Need help with preservesinglequotes() while inseting. You are using preservesinglequotes in the wrong. Normally you use it when you have escaped single quotes yourself and don't want CF to. In your case, you are NOT escaping single quotes, so you should remove the call and let CF handle it. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Need help with preservesinglequotes() while inseting.
I think it's the double quote that it doesn't like.That's just a guess... John -Original Message- From: Ketan Patel [mailto:[EMAIL PROTECTED] Sent: Thursday, January 08, 2004 3:54 PM To: CF-Talk Subject: RE: Need help with preservesinglequotes() while inseting. Hi Ray, Its does not likein my insert statement this: '13 1/2 Brass/Oak Ship's Wheel Clock,nautclocks,nautical gifts,ocean gifts,sea themed gifts', It doe snot like the single quote I think . Ketan Patel -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED] Sent: Thursday, January 08, 2004 3:41 PM To: CF-Talk Subject: RE: Need help with preservesinglequotes() while inseting. You are using preservesinglequotes in the wrong. Normally you use it when you have escaped single quotes yourself and don't want CF to. In your case, you are NOT escaping single quotes, so you should remove the call and let CF handle it. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Need help with preservesinglequotes() while inseting.
Show us your CF code now. Normally when you have '#foo#', foo will have the single quotes escaped. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: Need help with preservesinglequotes() while inseting.
Ketan Patel wrote: Its does not likein my insert statement this: '13 1/2 Brass/Oak Ship's Wheel Clock,nautclocks,nautical gifts,ocean gifts,sea themed gifts', It doe snot like the single quote I think . Correct. You should either follow Raymonds suggestion and remove all the PreserveSingleQuotes() calls, or change to use cfqueryparam. Jochem -- I don't get it immigrants don't work and steal our jobs - Loesje [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Need help with preservesinglequotes() while inseting.
Got it working. A minor typo had a double quote instead of single quote. Thanks for the help. Ketan Patel -Original Message- From: Jochem van Dieten [mailto:[EMAIL PROTECTED] Sent: Thursday, January 08, 2004 3:54 PM To: CF-Talk Subject: Re: Need help with preservesinglequotes() while inseting. Ketan Patel wrote: Its does not likein my insert statement this: '13 1/2 Brass/Oak Ship's Wheel Clock,nautclocks,nautical gifts,ocean gifts,sea themed gifts', It doe snot like the single quote I think . Correct. You should either follow Raymonds suggestion and remove all the PreserveSingleQuotes() calls, or change to use cfqueryparam. Jochem -- I don't get it immigrants don't work and steal our jobs - Loesje [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: Need help with preservesinglequotes() while inseting.
what is it you're looking for the preserveSingleQuotes() function to do? really oughtta be wrapping those values in cfqueryparam tags. - Original Message - From: Ketan Patel To: CF-Talk Sent: Thursday, January 08, 2004 1:42 PM Subject: Need help with preservesinglequotes() while inseting. Hi All, I am having hard time with preservesinglequotes() function in access table. I have a insert statement with following cfquery datasource=#request.dsn# name=insItem dbtype=ODBC INSERT INTO products ( id, state, sku, keywords, meta_description, image_a, image_b, title, short_description, content, taxable, price, build_date, edit_date, admin_user, ship_code, meta_title, vendorid ) VALUES( '#trim(variables.newid)#', #trim(getitem.Active)#, '#trim(GetItem.sku)#', '#trim(preservesinglequotes(getitem.kws))#', '#trim(preservesinglequotes(getitem.descs))#', '#trim(preservesinglequotes(getitem.image))#', '#trim(preservesinglequotes(getitem.image2))#', '#trim(preservesinglequotes(getitem.name))#', '#trim(preservesinglequotes(getitem.title))#', '#trim(preservesinglequotes(getitem.description))#', 1, '#trim(getitem.price)#', #CreateODBCDateTime(todayDate)#, #CreateODBCDateTime(todayDate)#, 'demo', 0, '#trim(preservesinglequotes(getitem.thetitle))#, '#trim(getitem.VID)#' ) /cfquery Following are the values getting inserted in to my access table INSERT INTO products ( id, state, sku,keywords, meta_description, image_a, image_b, title, short_description, content, taxable, price, build_date, edit_date, admin_user, ship_code, meta_title, vendorid ) VALUES( 'E72168FA-988F-455F-9CB6615CB6181EC1', 1, 'BEY-SQ509-SHIPSWHEELCLOCK', '13 1/2 Brass/Oak Ship's Wheel Clock,nautclocks,nautical gifts,ocean gifts,sea themed gifts', 'Nautical Gifts Online carries and other nautclocks.Quartz clock in solid brass tarnishproof porthole, solid oak ship's wheel.brDia: 13 1/2, D: 3 1/2', '/weather/SQ509.jpg', '', '13 1/2 Brass/Oak Ship's Wheel Clock', '13 1/2 Brass/Oak Ship's Wheel Clock from White Marlin Designs.', 'Quartz clock in solid brass tarnishproof porthole, solid oak ship's wheel.brDia: 13 1/2, D: 3 1/2', 1, '231.', {ts '2004-01-08 15:15:02'}, {ts '2004-01-08 15:15:02'}, 'ocean', 0, '13 1/2 Brass/Oak Ship's Wheel Clock - nautclocks at Nautical Gifts Online, 'DD9036B6-8C91-41E6-ABEC1157E85B86F4' ) Ketan Patel G3 Technology Group, LLC Graphics III Advertising, Inc. (410)789-7007 or (800)783-1799 It's Not Creative if it doesn't Sell. http://www.g3group.com http://www.g3group.com [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Need help with preservesinglequotes() while inseting.
One thing to try is to run your variables through PreserveSingleQuotes() before you do the query, i.e. cfset PSQvariable = PreserveSingleQuotes(variable) cfquery insert into blah(var) values('#Trim(PSQvariable)#') /cfquery Sounds odd, yes... but I've had troubles like that in the past and that's what worked. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]