Possible Duplicate:
Multiline String Literal in C#
I'm probably not asking the right questions of Google to find my answer. I just want to keep my code neat without having a really long string on one line. I want to move to the next line without breaking the string.
cmd.CommandText = "UPDATE players SET firstname = CASE id WHEN 1 THEN 'Jamie' WHEN 2 THEN 'Steve' WHEN 3 THEN 'Paula' END WHERE id IN (1,2,3)";
For example, I would like to break this into two lines without affecting the string. All help would be appreciated.
I suspect what you want is to use the @
for verbatim string literals; the advantage of verbatim strings is that escape sequences are not processed, and that they can span multiple lines.
cmd.CommandText = @"UPDATE players
SET firstname =
CASE id
WHEN 1 THEN 'Jamie'
WHEN 2 THEN 'Steve'
WHEN 3 THEN 'Paula'
END
WHERE id IN (1,2,3)";
Use @
symbol before string. It will say to compiler that string is multiline.
cmd.CommandText = @"UPDATE players
SET firstname = CASE id
WHEN 1 THEN 'Jamie'
WHEN 2 THEN 'Steve'
WHEN 3 THEN 'Paula'
END WHERE id IN (1,2,3)";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With