views:

34

answers:

1

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

 writer.WriteElementString("Value", 
 "=Parameters!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!

+2  A: 

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

writer.WriteElementString("Value", "=Parameters!StartDate.Value + \" To \" Parameters!EndDate.Value");
Remy Lebeau - TeamB
That worked great! Thank you!
JK