locked
Split Lines RRS feed

  • Question

  • User-797751191 posted

    Hi

      I have below code . I want to split into multiple lines

    string sql = "Update test set [Customer Id]=@CustomerId,[Customer Name]=@CustomerName,[Invoice No]=@InvoiceNo 
    ,[Posting Date]=@PostingDate,[No]=@No,[Date]=@Date,[Amount]=@Amount"

    Thanks

    Tuesday, July 2, 2019 6:12 AM

Answers

  • User-821857111 posted

    Do you mean like this?

    string sql = @"Update test set 
    [Customer Id] = @CustomerId,
    [Customer Name] = @CustomerName,
    [Invoice No] = @InvoiceNo ,
    [Posting Date] = @PostingDate,
    [No] = @No,
    [Date] = @Date,
    [Amount] = @Amount"

    The above example uses the @ prefix to allow you to break your verbatim string over multiple lines. It doesn't work if you use concatenation, but it works if you use string interpolation to include the value of variables within the string.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 2, 2019 6:36 AM