Please have a look at below code snippet -
in the first snippet I have made constant to provide a static format to string.. the second uses the constant to string.format the values received at runtime. But problem i m facing is - I am loosing the tag names, for example - <PolicyNumber> , <UserID>; I only recieve the value in xml nodes not the node names.. Please let me know if there is any way to maintain the xml structure from snippet 2.
************************************************** ******************************************
#1.
public static string conststrReportXML =
"<PARAMETERS><ReportPath>\\\\%COMPUTERNAME%\\ezsb\ \PMS\\</ReportPath><ReportName>ZZPMS</ReportName><ForceReport>True</ForceReport><DataConnectionString>DSN=COSPROD</DataConnectionString><ReturnType>5</ReturnType><DisplayFormat>5</DisplayFormat>" +
"<PolicyNumber>{0}</PolicyNumber>" +
"<CrystalReportName>{1}</CrystalReportName>" +
"<CrystalConnection>{2}</CrystalConnection>" +
"<UserID>{3}</UserID>" +
"<Password>{4}</Password>" +
"<DataBaseName>{5}</DataBaseName>" +
"<REPORTPARAMETERS>" +
"{6}{7}{8}{9}{10}{11}" +
"</REPORTPARAMETERS>" +
"</PARAMETERS>";
************************************************** ******************************************
#2
strXmlReportRequest = string.Format(conststrReportXML, strPolicyNumber, "rptMainLocationActivity.rpt",
Session["ReportServerName"].ToString(), Session["ReportUserID"].ToString(),
Session["ReportPassword"].ToString(), Session["ReportDatabaseName"].ToString(),
"<BeginDate>" + strBeginDate + "</BeginDate>",
"<EndDate>" + strEndDate + "</EndDate>",
"<PolicyNumbers>" + strPolicyNumbers + "</PolicyNumbers>",
"<UserName>" + strUserName + "</UserName>",
"<LocationTypes>" + strLocationTypes + "</LocationTypes>",
"<LocationTypeNames>" + strLocationTypeNames + "</LocationTypeNames>");
************************************************** ****************************************
Thanks in advance