How to add and dispaly SQL Report in ASP.Net web application

Posted on 2011-10-18
Last Modified: 2012-05-12
I created  a sql report using SQL2008R2.I want to add the report to ASP.Net web application.How to add the report to web application and display it in report viewer.

Question by:KavyaVS
    LVL 25

    Accepted Solution


    Author Comment

    I am not going to access the report from report server.I created a report and want to add it to the web application directly.

    How to add the report to web application and display it

    LVL 21

    Assisted Solution

    by:Alpesh Patel
    Place the report viewer on page and do as below:

    ReportViewer1.ServerReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings.Get("ReportServerUrl").ToString());
                    ReportViewer1.ServerReport.ReportPath = Request.QueryString["RptPath"]; //@"/Reports/NetSurplus";
                    IReportServerCredentials irsc = new CustomReportCredentials(ConfigurationManager.AppSettings.Get("ReportAdminUserName")
                        , ConfigurationManager.AppSettings.Get("ReportAdminPassword"), ConfigurationManager.AppSettings.Get("DomainName"));
                    ReportViewer1.ServerReport.ReportServerCredentials = irsc;
                    if (CurrentUser.RoleId == 3) //FPG Offices
                        ReportParameter RptParam = new ReportParameter(ConfigurationManager.AppSettings.Get("ReportOfficeParam"), CurrentUser.OfficeName);
                        ReportViewer1.ServerReport.SetParameters(new ReportParameter[] { RptParam });
                    ReportViewer1.ShowReportBody = true;
                    ReportViewer1.ShowToolBar = true;
                    ReportViewer1.ProcessingMode = ProcessingMode.Remote;
                    ReportViewer1.AsyncRendering = false;
                    ReportViewer1.SizeToReportContent = true;
                    ReportViewer1.ShowParameterPrompts = true; 

    Open in new window


    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    In this short article I will be talking about two functions in the SQL Server Reporting Services (SSRS) function stack.  Those functions are IIF() and Switch().  And I'll be showing you how easy it is to add an Else part to the Switch function. T…
    A recent questions about how to add SSRS named instances, couldn't find any that talks about SQL server 2008, anyway I decided to help by creating some screen shots. The installation is straightforward, you just pop the SQL server 2008 installati…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now