Escape sequence for double quotes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all

I’m using VB to build up a SQL string. Is there some way I can include
double quotes in the string, for example through an escape sequence?

Thanks again

David
 
David Cleave said:
Hi all

I'm using VB to build up a SQL string. Is there some way I can include
double quotes in the string, for example through an escape sequence?

Thanks again

David

Double the double quotes, e.g.:

strSQL = "SELECT * FROM some_table WHERE surname = ""Cleave"""
 
Brian said:
Double the double quotes, e.g.:

strSQL = "SELECT * FROM some_table WHERE surname = ""Cleave"""

Another option is to use Chr$(34) where you want the quote.

strSQL = "SELECT * FROM some_table WHERE surname = " & Chr$(34) & "Cleave" &
Chr$(34)
 
Back
Top