Hi
I have a basic question
I am using SQL command/query like
"INSERT INTO table1 (FName) VALUES (' " & sStr & " ' )"
If sStr (the string) contain the char " ' " then I get an error
I understand why it happened but I need a way around it
Thanks
Limor
Printable View
Hi
I have a basic question
I am using SQL command/query like
"INSERT INTO table1 (FName) VALUES (' " & sStr & " ' )"
If sStr (the string) contain the char " ' " then I get an error
I understand why it happened but I need a way around it
Thanks
Limor
If a string that has to be insert or update into a database countains any single '
you have to double them to 2 single ' , so the database knows it is a character of the string and not of the whole sql-statement.
Add the following line just before you put the whole sql-statement together.
sStr = sStr.Replace("'", "''")
Yes the old DoubleQuote Problem