What is the Statement Continuation Character in C#?

For readability, I would like to continue a statement on the next line.  I've tried the '&_' like so:

string striMyquery= "select distinct  a.item, b.cat from products a  '&_'
                                      inner join prodcategories b on a.item = b.item";

this give  a syntax error.  Thanks in advance
LVL 1
BoggyBayouBoyAsked:
Who is Participating?
 
josgoodConnect With a Mentor Commented:
Terminate the string and then use Plus sign, as in

string striMyquery= "select distinct  a.item, b.cat from products a  '&_'" +
                               "inner join prodcategories b on a.item = b.item";

Added closing quote and plus sign to first line.
Added beginning quote to second line
0
 
BoggyBayouBoyAuthor Commented:
Thanks!!!!!!
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
more options:
http://navaneethkn.wordpress.com/2007/09/19/writing-a-long-string-in-multiple-lines-c/


string striMyquery= @"select distinct  a.item, b.cat from products a  
                                      inner join prodcategories b on a.item = b.item";

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.