开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜