Welcome to WebmasterWorld Guest from 54.221.87.97

Forum Moderators: open

Message Too Old, No Replies

Help with SQL statement!

apostrophes and quotation marks

     

jefferson

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

10+ Year Member



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

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

WebmasterWorld Senior Member 10+ Year Member



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

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

wsp9

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

10+ Year Member



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

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

 

Featured Threads

Hot Threads This Week

Hot Threads This Month