homepage Welcome to WebmasterWorld Guest from 50.16.17.90
register, login, search, subscribe, help, library, PubCon, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library : Charter : Moderators: physics & whoisgregg

Databases Forum

    
Help with SQL statement!
apostrophes and quotation marks
jefferson




msg:1578926
 9:16 pm on Oct 17, 2005 (gmt 0)

i have a string variable(txtmessage)
txtmessage has both apostrophes and quotation marks

my insert statement looks like this:

strSQL = "INSERT INTO MYTABLE (MESSAGE) VALUES (" & TXTAMESSAGE & ")"

fails every time. i must be able to allow both quotes and apost... but how?

using access

 

iamlost




msg:1578927
 4:07 am on Oct 18, 2005 (gmt 0)

Try using square bracket delimiters:
[" & TXTAMESSAGE & "]

if that doesn't work search MS or online re: microsoft access delimiters or similar.

wsp9




msg:1578928
 4:44 am on Oct 18, 2005 (gmt 0)

Try replacing each apostrophe in the string variable with two consecutive apostrophes.

In vbscript I think the function is: txtmessage=replace(txtmessage,"'","''")

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
WebmasterWorld ® and PubCon ® are a Registered Trademarks of Pubcon Inc.
© Pubcon Inc. 1996-2012 all rights reserved