Start New Discussion within our Software Development Community
            cmd = new SqlCommand
            ("select beggining_school,
            end_school FROM Student,student_weekend,Weekend WHERE
            Student.ID=student_weekend.studentID AND  
            student_weekend.WeekendID=Weekend.ID ", con);

I just want to say that i don't have any problem concerning my code functionality. I would just like the design to be like the above example.That is, I dont'want my whole sql expression to be on the same line. However if i want my expression to be on more than one line somehow the string get's lost and visual studio doesn't treat the expression as a string anymore.

Two options. One is a verbatim string:

var query = @"select beggining_school,
end_school FROM Student,student_weekend,Weekend WHERE 
Student.ID=student_weekend.studentID AND 
student_weekend.WeekendID=Weekend.ID"

Note that indentation is significant in the string, as are newlines. The other, my preference, is literal concatenation because there aren't any "hidden" characters:

var query = 
    "select beggining_school," +
    "end_school FROM Student,student_weekend,Weekend WHERE " +
    "Student.ID=student_weekend.studentID AND " +
    "student_weekend.WeekendID=Weekend.ID"
This question has already been answered. Start a new discussion instead.