faqts : Computers : Programming : Languages : Asp : ASP/VBScript : Common Problems : Database and SQL

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

17 of 20 people (85%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

How can I set up the SQL statement to allow apostrophes in the WHERE clause, without causing a syntax error?

May 24th, 2000 07:45
unknown unknown, Serdar Kilic


You need to "escape" it

e.g.
strQuery = "Barron's"
strQuery = Replace(strQuery,"'","''")

strSQL = "SELECT myField FROM myTable WHERE myField = '" & strQuery & 
"'"



© 1999-2004 Synop Pty Ltd