PC Review


Reply
Thread Tools Rate Thread

quotation marks in string - how to add

 
 
Ufit
Guest
Posts: n/a
 
      5th Jul 2006
Simple,dumm question - how to include quotation marks in the string?
F.ex. "Data Source=.\SQLEXPRESS;AttachDbFilename="C:\client data.mdf";Integrated Security=True;User Instance=True"
I get syntax error.
Thanks for help

Ufi
 
Reply With Quote
 
 
 
 
Marina Levit [MVP]
Guest
Posts: n/a
 
      5th Jul 2006
You put them in twice. So something like:

Dim s as String = "Double quotes around test: ""test"""

"Ufit" <(E-Mail Removed)> wrote in message
news:e8gvt4$3nu$(E-Mail Removed)...
> Simple,dumm question - how to include quotation marks in the string?
> F.ex. "Data Source=.\SQLEXPRESS;AttachDbFilename="C:\client
> data.mdf";Integrated Security=True;User Instance=True"
> I get syntax error.
> Thanks for help
>
> Ufi



 
Reply With Quote
 
Jim Wooley
Guest
Posts: n/a
 
      5th Jul 2006
Another option:
String.Format("Data Source=.\SQLEXPRESS;AttachDbFilename={0}C:\client
data.mdf{0};Integrated Security=True;User Instance=True", ControlChars.Quote)
Jim Wooley
http://devauthority.com/blogs/jwooley/default.aspx

> Simple,dumm question - how to include quotation marks in the string?
>
> F.ex. "Data Source=.\SQLEXPRESS;AttachDbFilename="C:\client
> data.mdf";Integrated Security=True;User Instance=True"
>
> I get syntax error.
>
> Thanks for help
>
> Ufi
>



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      5th Jul 2006
"Ufit" <(E-Mail Removed)> schrieb:
> Simple,dumm question - how to include quotation marks in the string?
> F.ex. "Data Source=.\SQLEXPRESS;AttachDbFilename="C:\client
> data.mdf";Integrated Security=True;User Instance=True"
> I get syntax error.


Encode each quotation mark that should appear in the string as two
consecutive quotation marks:

\\\
s = "He said ""Hello World!"""
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I find quotation marks in a string using INSTR? String exa. =?Utf-8?B?R3JhbmRwYSBCZXJuaWU=?= Microsoft Access Queries 2 3rd May 2006 10:53 PM
Quotation Marks In String =?Utf-8?B?R3V5IFJvbmRlYXU=?= Microsoft Access VBA Modules 1 11th Apr 2004 12:25 AM
Re: Quotation marks in a string Phobos Microsoft Excel Misc 0 14th Sep 2003 07:51 PM
Re: Quotation marks in a string Earl Kiosterud Microsoft Excel Misc 0 14th Sep 2003 06:35 PM
Re: Quotation marks in a string Andy Brown Microsoft Excel Misc 0 14th Sep 2003 05:40 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:39 AM.