How to format an SQL Statement?

adolleschal

Member
Licensed User
Longtime User
Hi!

I have String which includes the ' char, when i now try to insert this String in a Table i get an SQL-Error because the String must also be quoted in '. How can I "escape" the ' and / or use a Insert Statement which allows those chars?

Example:

MyString = "This is a ' test"
SQLStmt = "INSERT INTO Testtable VALUES('" & MyString & "')"

This fails because of the above written problem.

Best regards
Andreas
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…