all groups > sql server reporting services > january 2006 >
You're in the

sql server reporting services

group:

ReportViewer control in webform


ReportViewer control in webform jhcorey NO[at]SPAM yahoo.com
1/3/2006 12:26:42 PM
sql server reporting services: I know this should be simple, but I can't find it. I'm trying to use
the reportviewer control
in a webform.
I'm following along with the example at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/RSAMPLES/htm/rss_sampleapps_v1_7944.asp

which is fine as far as it goes, but my report has parameters.

Elsewhere I've been able to render a report using

ParameterValue[] parameters = new ParameterValue[2];
....
MyReport.SetExecutionParameters(parameters, "en-us");

But in my current problem I've tried to use something similar, and also


ReportParameters[] = new ReportParameters[2];
....
ReportViewer1.ServerReport.SetParameters(ReportParameters);

without success.
If somebody has a working example I would appreciate it.

TIA,
Jim
Re: ReportViewer control in webform Teo Lachev [MVP]
1/3/2006 5:09:35 PM
What exactly is not working in your case? What happens if you don't set
parameters at all?

/// <summary>
/// Requests a remote report that runs under the context of the Report
Server
/// </summary>
private void RunRemote()
{

reportViewer.ProcessingMode =
Microsoft.Reporting.WebForms.ProcessingMode.Remote;
// Get the Report Server endpoint from the config file
reportViewer.ServerReport.ReportServerUrl = new
Uri(ConfigurationManager.AppSettings["ReportServerEndPoint"]);
reportViewer.ServerReport.ReportPath = <full report path>";
SetParameters();
}
/// <summary>
/// Set the report prameter for the Customer Orders report
/// </summary>
private void SetParameters()
{
ReportParameter[] parameters = new ReportParameter[2];
parameters[0] = new ReportParameter("Date", "1/1/2003");
parameters[1] = new ReportParameter("CustomerID", new string[] {
"14335", "15094" }); //multi-value parameter
reportViewer.ServerReport.SetParameters(parameters);

}

--
HTH,
----------------------------------------------
Teo Lachev, MVP, MCSD, MCT
"Microsoft Reporting Services in Action"
"Applied Microsoft Analysis Services 2005"
Home page and blog: http://www.prologika.com/

-------------------------------------------------
[quoted text, click to view]

Re: ReportViewer control in webform jhcorey NO[at]SPAM yahoo.com
1/4/2006 10:27:20 AM
I didn't note that I'm working in VS2005. I notice the link I noted
above is for VS2003.

Anyway, my problem may be finding the correct namespace for
ReportParameters.

I've included ReportExecution2005 as a web reference, and I can do
this:
ReportParameter[] parameters = new ReportParameter[2];
But when I do this:
parameters[0] = new ReportParameter("Date", "1/1/2003");

I get 'No overload method for Report Parameter takes 2 arguments'
If I use
parameters[0] = new ReportParameter();
then I can't find a property to set the value.
Re: ReportViewer control in webform jhcorey NO[at]SPAM yahoo.com
1/4/2006 10:44:25 AM
Ok, I'm moving forward. I'm using the Microsoft.Reporting.Webforms
namespace.
Which has a different ReportParameter.
AddThis Social Bookmark Button