Introduction
This article describes how to get and set the parameter value from the report:
Example
This example is composed of:
A sample report
A form that loads the report automatically and shows the preview report
A button that retrieves the parameter's actual value using the method:
private string GetParamValue (string paramName)
{
string tmpValue="";
for(int i=0;i<ReportDoc.DataDefinition.FormulaFields.Count; i++)
{
if(ReportDoc.DataDefinition.FormulaFields[i].FormulaName==
"{" + paramName + "}")
tmpValue= ReportDoc.DataDefinition.FormulaFields[i].Text ;
}
return tmpValue;
}
Another button that changes the values of the report using the textbox
text:
private void SetParamValue (string paramName, string paramValue)
{
for(int i=0;i<ReportDoc.DataDefinition.FormulaFields.Count; i++)
if(ReportDoc.DataDefinition.FormulaFields[i].FormulaName==
"{" + paramName + "}")
ReportDoc.DataDefinition.FormulaFields[i].Text = "\"" +paramValue +"\"";
}
German A. Fajardo G.
Web Developper
SQL Server Developer
PL/SQL Developer
Business Intelligence Desiggn Developer
ITIL Services Implementation.