|
-
Dec 10th, 2003, 04:45 AM
#1
Thread Starter
Fanatic Member
MYSQL problem with speech marks
Every time i try to insert a string which contains a single quote I get a nasty error message.
How do you guys get around this ?
Do I have to write code to find and replace or is there another way ?
-
Dec 10th, 2003, 11:01 PM
#2
Fanatic Member
A single quote is a special character in most DBMS. You have to, and should, excape all DB related special characters in any data you plan to UPDATE or INSERT.
If you are using MySQL, here is a string reference for special characters: http://www.mysql.com/doc/en/String_syntax.html
The single quote also applies to other DBMS such as MS Acces, MS SQL Server, Oracle, etc.. Look in their references guides.
A simple find and replace would do just wonderful.
Code:
newstr = Replace(datatobeinserted, "'", "''")
'-In other words,
newstr = Replace(datadobeinserted, Chr(34), Chr(34) & Chr(34))
Hope I have helped.
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
|