|
-
Dec 12th, 2002, 11:22 AM
#1
Thread Starter
Hyperactive Member
SQL and Apostrophes
Hello,
How do you deal with apostrophes when you are dealinf with a SQL statement?
i.e. , using update statement with one of the criteria containing an apostrophe - it gives an error
i.e. update name set code = 1 where name = ' " & name1 & " '
and name1= Smith's
Any ideas?
-
Dec 12th, 2002, 11:25 AM
#2
Re: SQL and Apostrophes
Originally posted by DaveR
Hello,
How do you deal with apostrophes when you are dealinf with a SQL statement?
i.e. , using update statement with one of the criteria containing an apostrophe - it gives an error
i.e. update name set code = 1 where name = ' " & name1 & " '
and name1= Smith's
Any ideas?
use the replace function
Code:
"update name set code = 1 where name = '" & replace(name1,"'","''") & "'"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|