开发者

Write to XML for creation of reporting services file, trouble with quotes

开发者 https://www.devze.com 2022-12-09 02:31 出处:网络
I can\'t figure out how to modify the C# code below, which works as it is. writer.WriteElementString(\"Value\",

I can't figure out how to modify the C# code below, which works as it is.

 writer.WriteElementString("Value", 
 "=Parameter开发者_开发知识库s!StartDate.Value + Parameters!EndDate.Value");

This results in the following in the XML file.

<Value>=Parameters!StartDate.Value + Parameters!EndDate.Value</Value>

I want to add the word "To", but I can't figure out how to do it given the required quotes when I write to xml.

I want the result to look like this:

<Value>=Parameters!StartDate.Value + " To " + Parameters!EndDate.Value</Value>

How do I modify the xml writer code listed above to get this result in the xml file? I can't figure out how to arrange the quotes in the original code to achieve this result.

Thanks!


You need to escape the quotes in your string literal, ie:

writer.WriteElementString("Value", "=Parameters!StartDate.Value + \" To \" Parameters!EndDate.Value"); 
0

精彩评论

暂无评论...
验证码 换一张
取 消