Escape sequence for double quotes

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
 
B

Brian

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"""
 
D

Douglas J. Steele

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top