none
Report Builder 2.0 Report, Report Viewer and ASP.NET RRS feed

  • Question

  • I have completed a report using Report Builder 2.0 with datasource connection embedded in the report.  Now, I want to add this report to ASP.NET webpage using the Report Viewer to view the report.   The report requires three parameters to run.  I have been looking for documention (sample code in either visual basic or c#) on how to add this report with the three parameters to a web page and I have not found any?  This can be in either a local report or server report mode.  Thanks. 

    Wednesday, July 8, 2009 10:59 PM

All replies

  • In server mode this is straightforward. Upload the report to a ReportServer, and view the report in ReportManager and make sure it is loading as expected. From there, add the ReportViewer to a webform, set its ProcessingMode property to Remote, set the ReportServer URL (it is usually something like http://myserver/ReportServer), then set the path to the report. From there the viewer and server will handle everything for you.

    In local mode it's a bit more involved. In local mode it is up to you to hook the data up to the report, you are essentially doing what the ReportServer typically does. Add the report to your project, and give it an rdlc extension. In local mode, you have to supply all the data yourself, so you will need to create datasources that match the data the report is expecting. Then you can hook these datasources up to the viewer with

    this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("MyReportsDataSet", myData));


    This blog post I wrote goes into how to setup the datasources and how to connect them to real data:
    http://blogs.msdn.com/magreer/archive/2008/10/16/setting-the-datasource-for-a-report-at-runtime.aspx
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Thursday, July 9, 2009 1:20 AM
  • Thank you for your reply.  I am using the server mode, added the ReportViewer to the webform, set the Report Server URL and path to the report that includes the report name.  When I run the webform with the ReportViewer, I get the error message:  "The request failed with HTTP status 401: Unauthorized.".  How do I supply the username and password?

    Thursday, July 9, 2009 5:00 PM
  • The account that is running the app with the viewer in it does not have permissions on the Report Server, as you know. You need to make use if IReportServerCredentials to let the viewer authenticate with the server. Brian's blog has a good post on this:

    http://blogs.msdn.com/brianhartman/archive/2008/11/21/custom-credentials-in-the-report-viewer.aspx



    This posting is provided "AS IS" with no warranties, and confers no rights.
    Thursday, July 9, 2009 5:18 PM
  • I have done the exact process, uploading, set the path and url, but I get this error when running my web app:
    The attempt to connect to the report server failed. Check your connection information and that the report server is a compatible version.
    befor that I save the rdl filethat was produced by report builder 2.0 as .rdlc, and add its path to the report path parameter. it generated an error that in forumes as mentioned that rdlc files from sql2008 is not compatible with .NET 2008! is this the problem? so what should I do? please help me.
    thank you.
    Sunday, September 27, 2009 3:26 PM