views:

293

answers:

2

hi all

i have a drop down list contains the name of reports and each report have a value (1,2,3...) and i have a popup window that appears when user click on view report button this popup is a web page that contains the report viewer ,,in cs of this popup page i have a swtich that takes int which is the value of the report eg.if i want to display the first report so i chose the first one in the drop down list and the selected value is 1 and it is passed to the page that contains the report viewer in a session variable and pass it to switch then case 1;........break so i want to know how to create an object of type report and bind it to the report viewer in each case ,,i have made something like that but i used crystal reports and crystal report viewer which has a

CrystalReportViewer1.ReportSource = rpt;
CrystalReportViewer1.DataBind();

and i have a report object

rpt.SetDataSource(dt);        
ReportDocument rpt;

but i cant do anything like that when i used reporting service

so please help

thanks

A: 

You are talking about the Microsoft SQL Server Reporting Services (SSRS), right?

The approach is a bit different than with Crystal - basically, SSRS is by default a server-based reporting engine, e.g. your application (Winforms or ASP.NET or whatever it is) doesn't actually render the report locally, and also it doesn't supply the data locally.

In SSRS, this is typically handled by the report itself and on the server. You typically only simply show the report (possibly configured with some report parameters), but all in all, the Reporting server will grab the data, format it, render the report, and your application really only shows the output in the end.

If you want to render a SSRS report locally, you need to have a *.rdlc file - do you have this, are you familiar with that option?

If you do - once you're into locally rendering the report, of course, you will also have to provide the data locally. If you use the ASP.NET or Winforms ReportViewer control, you can do this something like this:

ReportViewer reportViewer = new ReportViewer();

reportViewer.ProcessingMode = ProcessingMode.Local;
reportViewer.LocalReport.ReportPath = "Report1.rdlc"; // supply path to the RDLC file
reportViewer.LocalReport.DataSources.Add(.........)

reportViewer.RefreshReport();

Basically, you need to tell the ReportViewer control that you're dealing with local rendering, and then you need to give it the path to the RDLC file, and you can add as many data sources to the ReportViewer.LocalReport collection as you need to have for your report.

Does that help at all? Otherwise, please clarify your question a bit more.

See a VB.NET sample of retrieving data for a local report from a web service here.

marc_s
A: 

I tried doing this a while ago. I gave up because it wasn't that important, but my idea was this:

  1. Use web service to create a new datasource
  2. Use the web service to change the data source on the report
  3. Render the report in ReportViewer
  4. Switch DataSource back to original using web service.

My knowledge of ssrs is limited, but might be worth a shot.

TheSean