Re: Cannot seem to save a string with double quotes
From: Ignacio Machin \( .NET/ C# MVP \) ("Ignacio)
Date: 04/26/04
- Next message: Greg: "retrieve only active computers on the domain"
- Previous message: Mathieu Chavoutier: "C#, ugly Blue"
- In reply to: Steven Blair: "Cannot seem to save a string with double quotes"
- Next in thread: Michael A. Covington: "Re: Cannot seem to save a string with double quotes"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 26 Apr 2004 10:07:16 -0400
Hi Steven,
If I understand correctly you want both the \ and the " to appear in the
string right?
What is happening is that \ is the "escape character" meaning that the next
character should not be interpreted as a especial char.
So what \" gets converted in " and the \ is eliminated, cause it's used
only as a "escape"
Now if you want the \ to appear you just simply "escape" it too :)
\\ will do the trick
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Steven Blair" <steven.blair@btinternet.com> wrote in message
news:uj3IBY5KEHA.988@TK2MSFTNGP11.phx.gbl...
> Hi,
>
> I need to update a DB Table (MySQL 4.0) with a string representing a
> directory path (C:\Temp\In) but cannot get C# to do this.
>
> I take the string value from a textbox (myStr = myText.Text) and pass
> this to a function.
>
> The function builds up a SQL string which will be executed:
>
> SQLString = String.Format( "UPDATE BSConfig " +
> "SET BSConfig_Inbound = \"{0}\",myStr);
>
> This puts the quotes round the text, but remvoes the slashes. I tried
> using the @ character (not sure what you call this lol) and the \" but
> was given an error.
>
> SQLString = String.Format( @"UPDATE BSConfig " +
> "SET BSConfig_Inbound = \"{0}\",myStr); //Not allowed
>
> Anyone help me out ?
>
> Regards,
>
> Steven
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!
- Next message: Greg: "retrieve only active computers on the domain"
- Previous message: Mathieu Chavoutier: "C#, ugly Blue"
- In reply to: Steven Blair: "Cannot seem to save a string with double quotes"
- Next in thread: Michael A. Covington: "Re: Cannot seem to save a string with double quotes"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|