Home > Archive > Visual Basic Syntax > February 2005 > String creation incorporating double quotations
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
String creation incorporating double quotations
|
|
|
| Hi, I'm wondering how to create a string that includes double quotations to
be used to pass to a recordset. Part of the string is as follows:
strSQL = "<CheckItem FirstValue = "B" SecondValue = "2"/>"
Each time the compiler gets to a double quote, it thinks that's the end of
the string naturally, but I just can't figure out hoe to get around this. I
tried something like:
strSQL = strSQL & "<CheckItem FirstValue = ""
strsql = strsql & "B"
strSql = strSql & "" SecondValue = "
etc
but of course that doesn't work either. It's to be used with an OPENXML
statement so double quotes have to be used. How is this done?
Any suggestions would be very much appreciated
Ant
| |
| David Youngblood 2005-02-20, 3:59 pm |
| "Ant" <Ant@discussions.microsoft.com> wrote...
> Hi, I'm wondering how to create a string that includes double quotations to
> be used to pass to a recordset. Part of the string is as follows:
>
> strSQL = "<CheckItem FirstValue = "B" SecondValue = "2"/>"
You can double the quotation marks,
strSQL = "<CheckItem FirstValue = ""B"" SecondValue = ""2""/>"
> Each time the compiler gets to a double quote, it thinks that's the end of
> the string naturally, but I just can't figure out hoe to get around this. I
> tried something like:
>
> strSQL = strSQL & "<CheckItem FirstValue = ""
> strsql = strsql & "B"
> strSql = strSql & "" SecondValue = "
> etc
Or use Chr$(34),
strsql = strsql & "<CheckItem FirstValue = "
strsql = strsql & Chr$(34) & "B" & Chr$(34)
strsql = strsql & " SecondValue = "
strsql = strsql & Chr$(34) & "2" & Chr$(34)
strsql = strsql & "/>"
Debug.Print strsql
David
>
> but of course that doesn't work either. It's to be used with an OPENXML
> statement so double quotes have to be used. How is this done?
>
> Any suggestions would be very much appreciated
> Ant
>
| |
|
| Hi David,
Thanks very much for your help. As soon as I read the post I remembered "Ah
double quotations!" Thanks!
"David Youngblood" wrote:
> "Ant" <Ant@discussions.microsoft.com> wrote...
>
> You can double the quotation marks,
> strSQL = "<CheckItem FirstValue = ""B"" SecondValue = ""2""/>"
>
>
> Or use Chr$(34),
>
> strsql = strsql & "<CheckItem FirstValue = "
> strsql = strsql & Chr$(34) & "B" & Chr$(34)
> strsql = strsql & " SecondValue = "
> strsql = strsql & Chr$(34) & "2" & Chr$(34)
> strsql = strsql & "/>"
> Debug.Print strsql
>
> David
>
>
>
|
|
|
|
|