-2

我有

 string subquery="cmd cmd";

我需要

string query = @"asd 
asd  asd

asd asd
"+ MakeMultiline(subquery) + @"asd asd asd
asd asd where id=@id";

可以不更改子查询字符串的声明吗?

我需要这个,因为当我尝试时它会给出未完成的字符串文字错误。

4

1 回答 1

0

使用 Environment.NewLine 或使用 \n \r\n。

例子:

string query = "asd \n asd  asd \n asd asd"+ MakeMultiline(subquery) +
 "asd asd asd \n asd asd where id=@id";

不要通过使用 @ 来使用逐字字符串,除非您想定义转义序列两次。

于 2015-02-12T10:43:08.320 回答