Friday, March 30, 2012

How to get the value of a parameter programmatically

Hi,,
Say I have connected to the webs ervice and extracted all the parameters of
a particular report ,,how can I show the default bvalue of those parameter
if any'
thanks for your help,,here is my code:
ReportingService rs = new ReportingService(enviromental_Vars.LocalPath);
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
//string report = this.cmbReports.Items[this.cmbReports.SelectedIndex].ToString();
bool forRendering = false;
string historyID = null;
ParameterValue[] values = null;
DataSourceCredentials[] credentials = null;
ReportParameter[] parameters = null;
try
{
parameters = rs.GetReportParameters(enviromental_Vars.ReportName, historyID,
forRendering, values, credentials);
if (parameters != null)
{
}
}There is a property on the ReportParameter class with the name of
DefaultValues, and of type string[].
You could use something along the lines of:
foreach(ReportParameter p in parameters)
{
string[] defaults = p.DefaultValues;
// work on defaults...
}
--
Scott
http://www.OdeToCode.com/blogs/scott/
On Fri, 12 Nov 2004 19:12:19 -0800, "ALI-R" <newbie@.microsoft.com>
wrote:
>Hi,,
>Say I have connected to the webs ervice and extracted all the parameters of
>a particular report ,,how can I show the default bvalue of those parameter
>if any'
>thanks for your help,,here is my code:
>ReportingService rs = new ReportingService(enviromental_Vars.LocalPath);
>rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
>//string report =>this.cmbReports.Items[this.cmbReports.SelectedIndex].ToString();
>bool forRendering = false;
>string historyID = null;
>ParameterValue[] values = null;
>DataSourceCredentials[] credentials = null;
>ReportParameter[] parameters = null;
>try
>{
>parameters = rs.GetReportParameters(enviromental_Vars.ReportName, historyID,
>forRendering, values, credentials);
>if (parameters != null)
>{
>
>}
>}
>

No comments:

Post a Comment